240909-ChuanhuChatGPT集成Ollama的环境配置

news/2024/9/18 12:23:18/ 标签: ChuanhuChatGPT, Ollama, 前端, GUI, 大模型

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. 参考文献

在这里插入图片描述


http://www.ppmy.cn/news/1523224.html

相关文章

Axure中继器介绍

中继器我们一般在处理重复性比较高的任务时,能让我们达到事半功倍的效果,中继器在整个axure中属于复杂程度比较高的功能,我们今天大致讲一下常用的方法即可。 一、声明一个中继器 默认展示为三行。 点击样式,这里我们可以添加删…

python内置模块datetime.time类详细介绍

​​​​​​​Python的datetime模块是一个强大的日期和时间处理库,它提供了多个类来处理日期和时间。主要包括几个功能类datetime.date、datetime.time、datetime.datetime、datetime.timedelta,datetime.timezone等。 ----------动动小手,非常感谢各位…

C++解决:求排列数

描述 输入两个整数m,n&#xff0c;求m个数字中选n个数的排列数。&#xff08;1<n<m<50&#xff09; 输入描述 两个正整数m和n。 输出描述 一个正整数表示排列数。 用例输入 1 6 5 用例输出 1 720 AC code #include<bits/stdc.h> using namespace s…

Python操作ES集群API(增删改查等)

前言&#xff1a;本博客仅作记录学习使用&#xff0c;部分图片出自网络&#xff0c;如有侵犯您的权益&#xff0c;请联系删除 学习B站博主教程笔记&#xff1a; 最新版适合自学的ElasticStack全套视频&#xff08;Elk零基础入门到精通教程&#xff09;Linux运维必备—Elastic…

使用Protocol Buffers传输数据

使用 Google Protocol Buffers&#xff08;ProtoBuf&#xff09;与 Kafka 结合来定义和传输数据&#xff0c;可以确保传输数据的结构性、可扩展性和高效性。以下是一个简单的步骤指南&#xff0c;帮助你实现生产者和消费者。 1. 定义 ProtoBuf 消息格式 首先&#xff0c;你需…

九盾叉车U型区域警示灯,高效照明和安全警示

叉车运作的环境比较复杂&#xff0c;在方便人们物流运输的同时也存在着很大的安全隐患&#xff0c;特别是叉车碰撞人的事故发生率很高&#xff0c;那我们该怎么在减少成本的同时又能避免碰撞事故的发生呢&#xff1f; 九盾叉车U型区域警示灯&#xff0c;仅需一盏灯安装在叉车尾…

内容营销团队的7个核心角色

内容营销 是 如今的营销模式。 在那里&#xff0c;我说了。我感觉好多了。 当我的新书上市时&#xff0c;我会有更多的话题与大家在月底的内容营销世界大会上分享。 但是&#xff0c;这周我将阐述现代营销组织在内容营销中的核心角色和职责。 两周前&#xff0c;我强调了企…

51单片机-LED点阵屏实验(动态显示数据静态显示)

第一步喝口汤 个人理解&#xff1a;首先&#xff0c;这个LED点阵屏类似于数码的段选操作&#xff0c;这个LED点阵屏第一步就是利用595芯片来扩充IO&#xff0c;单片595就是能够把一个字节数据通过串行输入&#xff08;一个IO输入&#xff09;&#xff0c;并行输出&#xff08;…

流媒体技术革新,EasyCVR视频汇聚平台赋能视频监控全面升级

随着科技的飞速发展&#xff0c;流媒体技术和视频监控正经历着前所未有的变革与融合。本文将从流媒体技术的新兴趋势出发&#xff0c;探讨其与视频监控领域的深度结合&#xff0c;以及这一融合所带来的创新与发展。 一、流媒体技术的新兴趋势 1、5G网络的广泛应用 5G网络以其…

[数据集][目标检测]电梯内广告牌电动车检测数据集VOC+YOLO格式2787张4类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;2787 标注数量(xml文件个数)&#xff1a;2787 标注数量(txt文件个数)&#xff1a;2787 标注…

数据库的配置2:客户端navicat的安装与连接数据库的方法

二.客户端的配置&#xff1a; 1.navicat ①安装&#xff1a; 破解根据文档进行破解即可 链接: https://pan.baidu.com/s/1M5KUv_fgRlFA50VfcV1VqA 提取码: j4a2 复制这段内容后打开百度网盘手机App&#xff0c;操作更方便哦 安装步骤很简单&#xff0c;直接下一步就好&…

鸿蒙开发Tabs栏Scroll的使用 【第四篇】

Scroll 组件配置及使用 测试案例&#xff1a; tabBar的使用 默认自带左右切换效果 barMode属性&#xff0c;可以实现滚动导航栏 Tabs高级写法 组件结构复用&#xff09;

走进山东大学,美创赋能分享高校数据安全

9月4日&#xff0c;“信息网络安全杂志”进校园活动暨《网络工程与防御实践》第1讲&#xff0c;在山东大学顺利举办。 本次活动由公安部第三研究所《信息网络安全》杂志社主办&#xff0c;山东大学网络空间安全学院副研究员李增鹏主持&#xff0c;中国刑事警察学院公安信息技术…

SpringBoot2 快速实现《熔断机制》

1 熔断机制介绍 熔断机制&#xff08;Circuit Breaker Pattern&#xff09;是微服务架构中的一种保护机制&#xff0c;用于防止系统中某个服务连续发生故障&#xff0c;导致故障扩散&#xff0c;影响整个系统的可用性。熔断机制的原理类似于电路中的断路器&#xff0c;当系统检…

android kotlin基础复习 enum

1、kotlin中&#xff0c;关键字enum来定义枚举类型。枚举类型可以包含多个枚举常量&#xff0c;并且每个枚举常量可以有自己的属性和方法。 2、测试代码&#xff1a; enum class Color{RED,YELLOW,BLACK,GOLD,BLUE,GREEN,WHITE }inline fun <reified T : Enum<T>>…

Python全网最全基础课程笔记(六)——循环结构

本专栏系列为Pythong基础系列,每篇内容非常全面,包含全网各个知识点,非常长,请耐心看完。 每天都会更新新的内容,搜罗全网资源以及自己在学习和工作过程中的一些总结,可以说是非常详细和全面。 以至于为什么要写的这么详细:自己也是学过Python的,很多新手只是简单的过一…

DNS协议基础笔记

1.定义 DNS&#xff08;Domain Name System&#xff0c;域名系统&#xff09;是互联网的一项核心服务&#xff0c;它作为将域名和 IP 地址相互映射的一个分布式数据库&#xff0c;能够使人更方便地访问互联网。 2.域名解析过程 当用户在浏览器中输入一个域名&#xff0c;浏览…

File not found:git.exe

今天打开idea想使用Git进行项目代码的版本控制&#xff0c;在创建Git本地仓库时出现如下提示信息&#xff1a; File not found&#xff1a;git.exe Git没有安装&#xff1a;首先&#xff0c;你要确保你已经在电脑上安装了Git&#xff0c;Git是一个版本控制系统&#xff0c;你…

东南亚电商新蓝海:深度解析东南亚服务器租用的战略价值

在全球化日益加深的今天&#xff0c;东南亚以其独特的市场潜力和对数字化技术的积极拥抱&#xff0c;成为了跨境电商及互联网企业竞相角逐的热土。随着东南亚地区经济的快速增长和人口红利的持续释放&#xff0c;电商市场的繁荣景象尤为引人注目。然而&#xff0c;要在这一竞争…

爆改YOLOv8|利用yolov10的SCDown改进yolov8-下采样

1, 本文介绍 YOLOv10 的 SCDown 方法来优化 YOLOv8 的下采样过程。SCDown 通过点卷积调整通道维度&#xff0c;再通过深度卷积进行空间下采样&#xff0c;从而减少了计算成本和参数数量。这种方法不仅降低了延迟&#xff0c;还在保持下采样过程信息的同时提供了竞争性的性能。…