当前位置: 首页 > news >正文

240909-ChuanhuChatGPT集成Ollama的环境配置

A. 最终效果

在这里插入图片描述

B. 需求文件

  • requirements.txt (至少需要安装这个,具体参见官网)
  • requirements_advanced.txt (如果安装了Ollama,并且可以进行对话,可以不需要安装,具体参见官网)
  • requirements_succcess.txt(由于新旧版本版本不兼容,我这边在Ubuntu22.04条时候的最终版本,如下)
aiofiles==23.2.1
aiohappyeyeballs==2.4.0
aiohttp==3.10.5
aiosignal==1.3.1
altair==5.4.1
annotated-types==0.7.0
anthropic==0.18.1
anyio==4.4.0
arxiv==2.1.3
async-timeout==4.0.3
attrs==24.2.0
backoff==2.2.1
backports.tarfile==1.2.0
beautifulsoup4==4.12.3
cachetools==5.5.0
certifi==2024.8.30
cffi==1.17.1
chardet==5.2.0
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6
commentjson==0.9.0
contourpy==1.3.0
cryptography==43.0.1
cycler==0.12.1
dataclasses-json==0.6.7
deepdiff==8.0.1
distro==1.9.0
docstring_parser==0.16
duckduckgo_search==6.2.8
emoji==2.12.1
et-xmlfile==1.1.0
exceptiongroup==1.2.2
faiss-cpu==1.7.4
fastapi==0.112.4
feedparser==6.0.11
ffmpy==0.4.0
filelock==3.16.0
filetype==1.2.0
fonttools==4.53.1
frozenlist==1.4.1
fsspec==2024.9.0
google-ai-generativelanguage==0.6.6
google-api-core==2.19.2
google-api-python-client==2.144.0
google-auth==2.34.0
google-auth-httplib2==0.2.0
google-cloud-aiplatform==1.65.0
google-cloud-bigquery==3.25.0
google-cloud-core==2.4.1
google-cloud-resource-manager==1.12.5
google-cloud-storage==2.18.2
google-crc32c==1.6.0
google-generativeai==0.7.2
google-resumable-media==2.7.2
google_search_results==2.4.2
googleapis-common-protos==1.65.0
googlesearch-python==1.2.5
gradio==4.26.0
gradio_client==0.15.1
greenlet==3.0.3
groq==0.11.0
grpc-google-iam-v1==0.13.1
grpcio==1.66.1
grpcio-status==1.48.2
h11==0.14.0
httpcore==1.0.5
httplib2==0.22.0
httpx==0.27.2
huggingface-hub==0.24.6
idna==3.8
importlib_resources==6.4.4
jaraco.context==6.0.1
Jinja2==3.1.4
joblib==1.4.2
jsonpatch==1.33
jsonpath-python==1.0.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
kiwisolver==1.4.7
langchain==0.1.14
langchain-community==0.0.38
langchain-core==0.1.52
langchain-openai==0.1.5
langchain-text-splitters==0.0.2
langchainhub==0.1.21
langdetect==1.0.9
langsmith==0.1.116
lark-parser==0.7.8
lxml==5.3.0
Markdown==3.7
markdown-it-py==3.0.0
MarkupSafe==2.1.5
marshmallow==3.22.0
matplotlib==3.9.2
mdurl==0.1.2
more-itertools==10.5.0
multidict==6.0.5
mypy-extensions==1.0.0
narwhals==1.6.3
nest-asyncio==1.6.0
nltk==3.9.1
numexpr==2.10.1
numpy==1.26.4
olefile==0.47
ollama==0.3.2
openai==1.16.2
openpyxl==3.1.5
orderly-set==5.2.2
orjson==3.10.7
packaging==23.2
pandas==2.2.2
pandoc==2.4
pdfminer.six==20231228
pdfplumber==0.11.4
pillow==10.4.0
plumbum==1.8.3
ply==3.11
primp==0.5.5
proto-plus==1.24.0
protobuf==3.20.3
psutil==6.0.0
pyasn1==0.6.0
pyasn1_modules==0.4.0
pycparser==2.22
pydantic==2.5.2
pydantic_core==2.14.5
pydub==0.25.1
Pygments==2.18.0
pyparsing==3.1.4
pypdf==4.3.1
PyPDF2==3.0.1
pypdfium2==4.30.0
pypinyin==0.52.0
python-dateutil==2.9.0.post0
python-docx==1.1.2
python-iso639==2024.4.27
python-magic==0.4.27
python-multipart==0.0.9
python-oxmsg==0.0.1
pytz==2024.1
PyYAML==6.0.2
rapidfuzz==3.9.7
referencing==0.35.1
regex==2024.7.24
requests==2.32.3
requests-toolbelt==1.0.0
rich==13.8.0
rpds-py==0.20.0
rsa==4.9
ruff==0.6.4
semantic-version==2.10.0
sgmllib3k==1.0.0
shapely==2.0.6
shellingham==1.5.4
six==1.16.0
sniffio==1.3.1
socksio==1.0.0
soupsieve==2.6
SQLAlchemy==2.0.34
starlette==0.38.5
tabulate==0.9.0
tenacity==8.5.0
tiktoken==0.7.0
tokenizers==0.20.0
tomlkit==0.12.0
tqdm==4.66.5
typer==0.12.5
types-requests==2.32.0.20240907
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.1
ujson==5.10.0
unstructured==0.15.9
unstructured-client==0.25.7
uritemplate==4.1.1
urllib3==2.2.2
uvicorn==0.30.6
websocket-client==1.8.0
websockets==11.0.3
wikipedia==1.4.0
wolframalpha==5.1.3
wrapt==1.16.0
xmltodict==0.13.0
yarl==1.11.0

C. 环境配置

{// 各配置具体说明,见 [https://github.com/GaiZhenbiao/ChuanhuChatGPT/wiki/使用教程#配置-configjson]//== API 配置 ==// ⭐️ 这里填写的Ollama"openai_api_key": "Ollama", // 你的 OpenAI API Key,一般必填,若空缺则需在图形界面中填入API Key"google_genai_api_key": "", // 你的 Google Gemini API Key ,用于 Google Gemini 对话模型"xmchat_api_key": "", // 你的 xmchat API Key,用于 XMChat 对话模型"minimax_api_key": "", // 你的 MiniMax API Key,用于 MiniMax 对话模型"minimax_group_id": "", // 你的 MiniMax Group ID,用于 MiniMax 对话模型"midjourney_proxy_api_base": "https://xxx/mj", // 你的 https://github.com/novicezk/midjourney-proxy 代理地址"midjourney_proxy_api_secret": "", // 你的 MidJourney Proxy API Secret,用于鉴权访问 api,可选"midjourney_discord_proxy_url": "", // 你的 MidJourney Discord Proxy URL,用于对生成对图进行反代,可选"midjourney_temp_folder": "./tmp", // 你的 MidJourney 临时文件夹,用于存放生成的图片,填空则关闭自动下载切图(直接显示MJ的四宫格图)"spark_appid": "", // 你的 讯飞星火大模型 API AppID,用于讯飞星火大模型对话模型"spark_api_key": "", // 你的 讯飞星火大模型 API Key,用于讯飞星火大模型对话模型"spark_api_secret": "", // 你的 讯飞星火大模型 API Secret,用于讯飞星火大模型对话模型"claude_api_secret":"",// 你的 Claude API Secret,用于 Claude 对话模型"ernie_api_key": "",// 你的文心一言在百度云中的API Key,用于文心一言对话模型"ernie_secret_key": "",// 你的文心一言在百度云中的Secret Key,用于文心一言对话模型"ollama_host": "", // 你的 Ollama Host,用于 Ollama 对话模型"huggingface_auth_token": "", // 你的 Hugging Face API Token,用于访问有限制的模型"groq_api_key": "", // 你的 Groq API Key,用于 Groq 对话模型(https://console.groq.com/)//== Azure =="openai_api_type": "openai", // 可选项:azure, openai"azure_openai_api_key": "", // 你的 Azure OpenAI API Key,用于 Azure OpenAI 对话模型"azure_openai_api_base_url": "", // 你的 Azure Base URL"azure_openai_api_version": "2023-05-15", // 你的 Azure OpenAI API 版本"azure_deployment_name": "", // 你的 Azure OpenAI Chat 模型 Deployment 名称"azure_embedding_deployment_name": "", // 你的 Azure OpenAI Embedding 模型 Deployment 名称"azure_embedding_model_name": "text-embedding-ada-002", // 你的 Azure OpenAI Embedding 模型名称//== 基础配置 =="language": "auto", // 界面语言,可选"auto", "zh_CN", "en_US", "ja_JP", "ko_KR", "sv_SE", "ru_RU", "vi_VN""users": [], // 用户列表,[["用户名1", "密码1"], ["用户名2", "密码2"], ...]"local_embedding": false, //是否在本地编制索引"hide_history_when_not_logged_in": false, //未登录情况下是否不展示对话历史"check_update": true, //是否启用检查更新"default_model": "Ollama", // 默认模型"chat_name_method_index": 2, // 选择对话名称的方法。0: 使用日期时间命名;1: 使用第一条提问命名,2: 使用模型自动总结"bot_avatar": "default", // 机器人头像,可填写本地或网络图片链接,或者"none"(不显示头像)"user_avatar": "default", // 用户头像,可填写本地或网络图片链接,或者"none"(不显示头像)//== API 用量 =="show_api_billing": false, //是否显示OpenAI API用量(启用需要填写sensitive_id)"sensitive_id": "", // 你 OpenAI 账户的 Sensitive ID,用于查询 API 用量"usage_limit": 120, // 该 OpenAI API Key 的当月限额,单位:美元,用于计算百分比和显示上限"legacy_api_usage": false, // 是否使用旧版 API 用量查询接口(OpenAI现已关闭该接口,但是如果你在使用第三方 API,第三方可能仍然支持此接口)//== 川虎助理设置 =="GOOGLE_CSE_ID": "", //谷歌搜索引擎ID,用于川虎助理Pro模式,获取方式请看 https://stackoverflow.com/questions/37083058/programmatically-searching-google-in-python-using-custom-search"GOOGLE_API_KEY": "", //谷歌API Key,用于川虎助理Pro模式"WOLFRAM_ALPHA_APPID": "", //Wolfram Alpha API Key,用于川虎助理Pro模式,获取方式请看 https://products.wolframalpha.com/api/"SERPAPI_API_KEY": "", //SerpAPI API Key,用于川虎助理Pro模式,获取方式请看 https://serpapi.com///== 文档处理与显示 =="latex_option": "default", // LaTeX 公式渲染策略,可选"default", "strict", "all"或者"disabled""advance_docs": {"pdf": {"two_column": false, // 是否认为PDF是双栏的"formula_ocr": true // 是否使用OCR识别PDF中的公式}},//== 高级配置 ==// 是否多个API Key轮换使用"multi_api_key": false,"hide_my_key": false, // 如果你想在UI中隐藏 API 密钥输入框,将此值设置为 true// "available_models": ["GPT3.5 Turbo", "GPT4 Turbo", "GPT4 Vision"], // 可用的模型列表,将覆盖默认的可用模型列表// "extra_models": ["模型名称3", "模型名称4", ...], // 额外的模型,将添加到可用的模型列表之后// "api_key_list": [//     "sk-xxxxxxxxxxxxxxxxxxxxxxxx1",//     "sk-xxxxxxxxxxxxxxxxxxxxxxxx2",//     "sk-xxxxxxxxxxxxxxxxxxxxxxxx3"// ],// 自定义OpenAI API Base// "openai_api_base": "https://api.openai.com",// 自定义使用代理(请替换代理URL)// "https_proxy": "http://127.0.0.1:1079",// "http_proxy": "http://127.0.0.1:1079",// 自定义端口、自定义ip(请替换对应内容)"server_name": "0.0.0.0","server_port": 7860,// 如果要share到gradio,设置为true// "share": false,//如果不想自动打开浏览器,设置为false//"autobrowser": false// ⭐️ 用户界面中将会显示的模型"available_models": ["qwen2:7b", "llama3.1:8b"], // ⭐️ 手动添加的Ollama模型,api_host与model_name需要和Ollama对应上"extra_model_metadata": { //"qwen2:7b": {"model_name": "qwen2:7b","description": "An expert of mean jokes, who answers all user questions in a humorous and mean way.","model_type": "OpenAIVision","multimodal": false,// "api_host": "http://localhost:11434/v1/chat/completions","api_host": "http://localhost:11434","token_limit": 4096,"max_generation": 4096,"system": "You are an expert of mean jokes. You Answer all user questions in a humorous and mean way, pretending you are Elon Musk.","placeholder": {"logo": "https://wallpaperaccess.com/full/9170621.png","slogan": "I am NOT politically correct","question_1": "How can I get X Premium+?","question_2": "Roast me pls","question_3": "What's the true nature of the universe","question_4": "Ai is biased",}},"llama3.1:8b": {"model_name": "llama3.1:8b","description": "An expert of mean jokes, who answers all user questions in a humorous and mean way.","model_type": "OpenAIVision","multimodal": false,// "api_host": "http://localhost:11434/v1/chat/completions","api_host": "http://localhost:11434","token_limit": 4096,"max_generation": 4096,"system": "You are an expert of mean jokes. You Answer all user questions in a humorous and mean way, pretending you are Elon Musk.","placeholder": {"logo": "https://wallpaperaccess.com/full/9170621.png","slogan": "I am NOT politically correct","question_1": "How can I get X Premium+?","question_2": "Roast me pls","question_3": "What's the true nature of the universe","question_4": "Ai is biased",}},},}

D. 问题解决

  • 在运行代码的时候会报错,主要是安装包版本不兼容的问题
  • 我这边在先后执行玩下面的操作后,可以正常运行代码
pip install --upgrade gradio
pip install gradio==4.26.0
pip install gradio==4.29.0

E. 参考文献

  • 自定义模型 Custom Models · GaiZhenbiao/ChuanhuChatGPT Wiki

在这里插入图片描述

相关文章:

  • 北京网站建设多少钱?
  • 辽宁网页制作哪家好_网站建设
  • 高端品牌网站建设_汉中网站制作
  • 101.游戏安全项目-创建人物对象结构
  • 游戏开发引擎___unity位置信息和unlit shader(无光照着色器)的使用,以桌子的渲染为例
  • 【devops】devops-git之介绍以及日常使用
  • 【代码随想录训练营第42期 Day57打卡 - 图论Part7 - Prim算法与Kruskal算法
  • oracle 使用 PL/SQL Developer创建表并插入单条、多条数据
  • MySQL——数据库的高级操作(二)用户管理(4)修改用户密码
  • 算法面经手撕系列(2)--手撕BatchNormlization
  • 基于鸿蒙API10的RTSP播放器(二:视频切换实现)
  • 类的继承性和多态性
  • 微生物分类检测系统源码分享
  • 004: VTK读入数据---vtkImageData详细说明
  • Go语言中的链表与双向链表实现
  • 食品分类2检测系统源码分享
  • 【Vue嵌套数据中,实现动态表头和内容】
  • 《职教论坛》
  • “大数据应用场景”之隔壁老王(连载四)
  • Akka系列(七):Actor持久化之Akka persistence
  • Dubbo 整合 Pinpoint 做分布式服务请求跟踪
  • Fundebug计费标准解释:事件数是如何定义的?
  • rabbitmq延迟消息示例
  • Spring Cloud Feign的两种使用姿势
  • tweak 支持第三方库
  • vue-cli在webpack的配置文件探究
  • 从setTimeout-setInterval看JS线程
  • 从重复到重用
  • 服务器从安装到部署全过程(二)
  • 解析带emoji和链接的聊天系统消息
  • 每天一个设计模式之命令模式
  • 爬虫模拟登陆 SegmentFault
  • 如何编写一个可升级的智能合约
  • 算法---两个栈实现一个队列
  • 一个SAP顾问在美国的这些年
  • LIGO、Virgo第三轮探测告捷,同时探测到一对黑洞合并产生的引力波事件 ...
  • #绘制圆心_R语言——绘制一个诚意满满的圆 祝你2021圆圆满满
  • #微信小程序:微信小程序常见的配置传旨
  • (35)远程识别(又称无人机识别)(二)
  • (4)事件处理——(7)简单事件(Simple events)
  • (6)添加vue-cookie
  • (力扣记录)1448. 统计二叉树中好节点的数目
  • (六) ES6 新特性 —— 迭代器(iterator)
  • (南京观海微电子)——示波器使用介绍
  • (四)软件性能测试
  • (一)搭建springboot+vue前后端分离项目--前端vue搭建
  • (转)微软牛津计划介绍——屌爆了的自然数据处理解决方案(人脸/语音识别,计算机视觉与语言理解)...
  • ****三次握手和四次挥手
  • .NET Framework与.NET Framework SDK有什么不同?
  • .NET精简框架的“无法找到资源程序集”异常释疑
  • ::before和::after 常见的用法
  • [023-2].第2节:SpringBoot中接收参数相关注解
  • [2018/11/18] Java数据结构(2) 简单排序 冒泡排序 选择排序 插入排序
  • [Android] 修改设备访问权限
  • [asp.net core]project.json(2)
  • [go] 迭代器模式
  • [hdu 3065] 病毒侵袭持续中 [AC自动机] [病毒特征码匹配]
  • [JavaScript]_[初级]_[关于forin或for...in循环语句的用法]