sugarforever / chat-ollama

ChatOllama is an open source chatbot based on LLMs. It supports a wide range of language models, and knowledge base management.
MIT License
2.56k stars 395 forks source link

本地知识库添加PDF文件报错Error: Chroma getOrCreateCollection error: Error: TypeError: fetch failed #385

Open NewSNode opened 4 months ago

NewSNode commented 4 months ago

运行环境: ChatOllama使用docker compose安装并运行,Ollama使用docker运行。 在Setting中配置本地Ollama的Host:http://host.docker.internal:11434

操作方法: 登录ChatOllama; 创建本地知识库,Embedding使用Ollama的nomic-embed-text(已下载); 选择一个PDF文件,点击“save”按钮,查看ChatOllama后台日志,发现报错。

ChatOllama报错日志如下: 2024-04-28 12:21:01 URL: /api/auth/login User: null 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:02 URL: /api/knowledgebases User: {"id":1,"name":"xxx(我的实际值)","email":"xxxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:02 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:25 URL: /api/knowledgebases/5 User: {"id":1,"name":"xxxx(我的实际值)","email":"xxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:25 Ollama: { 2024-04-28 12:21:25 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:25 username: null, 2024-04-28 12:21:25 password: null 2024-04-28 12:21:25 } 2024-04-28 12:21:26 Knowledge base ID: 5 2024-04-28 12:21:26 Ollama: { 2024-04-28 12:21:26 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:26 username: null, 2024-04-28 12:21:26 password: null 2024-04-28 12:21:26 } 2024-04-28 12:21:26 Authorization: bnVsbDpudWxs 2024-04-28 12:21:26 Update knowledge base 工业互联网 with ID 5 2024-04-28 12:21:27 Creating embeddings for Ollama served model: nomic-embed-text 2024-04-28 12:21:27 Creating Chroma vector store 2024-04-28 12:21:27 Initializing ParentDocumentRetriever with RedisDocstore 2024-04-28 12:21:27 Redis client options: { host: 'redis', port: 6379, username: undefined, password: undefined } 2024-04-28 12:22:32 Error: Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (file:///app/.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (file:///app/.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (file:///app/.output/server/chunks/runtime.mjs:3391:7) 2024-04-28 12:22:32 [nuxt] [request error] [unhandled] [500] Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23)
2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-04-28 12:22:32 at async Chroma.addVectors (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28)
2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (./.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13)
2024-04-28 12:22:32 at async ingestDocument (./.output/server/chunks/
/rag.mjs:297:3)
2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7)
2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/runtime.mjs:3125:19)
2024-04-28 12:22:32 at async Server.toNodeHandle (./.output/server/chunks/runtime.mjs:3391:7)

各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!!

其他信息补充: 1、使用Ollama下载到本地llama3模型可正常交互; 2、docker-compose.yaml文件内容(将Chromadb的端口改成了8300、ChatOllama镜像的端口改成了3300): version: '3.1' services: chromadb: image: chromadb/chroma ports:

volumes: chromadb_data: redis_data:

suhengli commented 4 months ago

我也遇到了这个问题

sugarforever commented 4 months ago

运行环境: ChatOllama使用docker compose安装并运行,Ollama使用docker运行。 在Setting中配置本地Ollama的Host:http://host.docker.internal:11434。

操作方法: 登录ChatOllama; 创建本地知识库,Embedding使用Ollama的nomic-embed-text(已下载); 选择一个PDF文件,点击“save”按钮,查看ChatOllama后台日志,发现报错。

ChatOllama报错日志如下: 2024-04-28 12:21:01 URL: /api/auth/login User: null 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:02 URL: /api/knowledgebases User: {"id":1,"name":"xxx(我的实际值)","email":"xxxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:02 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:25 URL: /api/knowledgebases/5 User: {"id":1,"name":"xxxx(我的实际值)","email":"xxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:25 Ollama: { 2024-04-28 12:21:25 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:25 username: null, 2024-04-28 12:21:25 password: null 2024-04-28 12:21:25 } 2024-04-28 12:21:26 Knowledge base ID: 5 2024-04-28 12:21:26 Ollama: { 2024-04-28 12:21:26 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:26 username: null, 2024-04-28 12:21:26 password: null 2024-04-28 12:21:26 } 2024-04-28 12:21:26 Authorization: bnVsbDpudWxs 2024-04-28 12:21:26 Update knowledge base 工业互联网 with ID 5 2024-04-28 12:21:27 Creating embeddings for Ollama served model: nomic-embed-text 2024-04-28 12:21:27 Creating Chroma vector store 2024-04-28 12:21:27 Initializing ParentDocumentRetriever with RedisDocstore 2024-04-28 12:21:27 Redis client options: { host: 'redis', port: 6379, username: undefined, password: undefined } 2024-04-28 12:22:32 Error: Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (file:///app/.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (file:///app/.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (file:///app/.output/server/chunks/runtime.mjs:3391:7) 2024-04-28 12:22:32 [nuxt] [request error] [unhandled] [500] Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (./.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (./.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (./.output/server/chunks/runtime.mjs:3391:7)

各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!!

其他信息补充: 1、使用Ollama下载到本地llama3模型可正常交互; 2、docker-compose.yaml文件内容(将Chromadb的端口改成了8300、ChatOllama镜像的端口改成了3300): version: '3.1' services: chromadb: image: chromadb/chroma ports: - "8300:8000" restart: always volumes: - chromadb_data:/chroma/.chroma/index

chatollama: environment: - CHROMADB_URL=http://chromadb:8300 - DATABASE_URL=file:/app/sqlite/chatollama.sqlite - REDIS_HOST=redis image: 0001coder/chatollama:latest ports: - "3300:3000" pull_policy: always restart: always volumes: - ~/.chatollama:/app/sqlite

redis: image: redis:latest restart: always volumes: - redis_data:/data

volumes: chromadb_data: redis_data:

虽然对Chromadb做了端口映射,你在ChatOllama中的配置还是应该用8000端口

- CHROMADB_URL=http://chromadb:8000

这里用的是docker compose 服务构建的容器间网络的域名和端口。8300只是容器对外暴露的端口。

你更改 CHROMADB_URL 环境变量再试试

suhengli commented 4 months ago

运行环境: ChatOllama使用docker compose安装并运行,Ollama使用docker运行。 在Setting中配置本地Ollama的Host:http://host.docker.internal:11434。 操作方法: 登录ChatOllama; 创建本地知识库,Embedding使用Ollama的nomic-embed-text(已下载); 选择一个PDF文件,点击“save”按钮,查看ChatOllama后台日志,发现报错。 ChatOllama报错日志如下: 2024-04-28 12:21:01 URL: /api/auth/login User: null 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:02 URL: /api/knowledgebases User: {"id":1,"name":"xxx(我的实际值)","email":"xxxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:02 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:25 URL: /api/knowledgebases/5 User: {"id":1,"name":"xxxx(我的实际值)","email":"xxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:25 Ollama: { 2024-04-28 12:21:25 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:25 username: null, 2024-04-28 12:21:25 password: null 2024-04-28 12:21:25 } 2024-04-28 12:21:26 Knowledge base ID: 5 2024-04-28 12:21:26 Ollama: { 2024-04-28 12:21:26 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:26 username: null, 2024-04-28 12:21:26 password: null 2024-04-28 12:21:26 } 2024-04-28 12:21:26 Authorization: bnVsbDpudWxs 2024-04-28 12:21:26 Update knowledge base 工业互联网 with ID 5 2024-04-28 12:21:27 Creating embeddings for Ollama served model: nomic-embed-text 2024-04-28 12:21:27 Creating Chroma vector store 2024-04-28 12:21:27 Initializing ParentDocumentRetriever with RedisDocstore 2024-04-28 12:21:27 Redis client options: { host: 'redis', port: 6379, username: undefined, password: undefined } 2024-04-28 12:22:32 Error: Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (file:///app/.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (file:///app/.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (file:///app/.output/server/chunks/runtime.mjs:3391:7) 2024-04-28 12:22:32 [nuxt] [request error] [unhandled] [500] Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (./.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (./.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (./.output/server/chunks/runtime.mjs:3391:7) 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 其他信息补充: 1、使用Ollama下载到本地llama3模型可正常交互; 2、docker-compose.yaml文件内容(将Chromadb的端口改成了8300、ChatOllama镜像的端口改成了3300): version: '3.1' services: chromadb: image: chromadb/chroma ports: - "8300:8000" restart: always volumes: - chromadb_data:/chroma/.chroma/index chatollama: environment: - CHROMADB_URL=http://chromadb:8300 - DATABASE_URL=file:/app/sqlite/chatollama.sqlite - REDIS_HOST=redis image: 0001coder/chatollama:latest ports: - "3300:3000" pull_policy: always restart: always volumes: - ~/.chatollama:/app/sqlite redis: image: redis:latest restart: always volumes: - redis_data:/data volumes: chromadb_data: redis_data:

虽然对Chromadb做了端口映射,你在ChatOllama中的配置还是应该用8000端口

- CHROMADB_URL=http://chromadb:8000

这里用的是docker compose 服务构建的容器间网络的域名和端口。8300只是容器对外暴露的端口。

你更改 CHROMADB_URL 环境变量再试试

我的chromadb映射和容器端口都是8000,但还是一样的问题

NewSNode commented 4 months ago

更改了 CHROMADB_URL参数,如下: image

创建知识库还是报错,日志如下: 2024-05-06 15:32:25 Authorization: bnVsbDpudWxs 2024-05-06 15:32:25 Current User: { 2024-05-06 15:32:25 id: 1, 2024-05-06 15:32:25 name: 'New1', 2024-05-06 15:32:25 email: 'xxxx@qq.com', 2024-05-06 15:32:25 role: 'user', 2024-05-06 15:32:25 scope: [ 'test', 'user' ], 2024-05-06 15:32:25 iat: 1714980130, 2024-05-06 15:32:25 exp: 1746516130 2024-05-06 15:32:25 } 2024-05-06 15:32:25 Created knowledge base Test01: 1 by New1 2024-05-06 15:32:26 Creating embeddings for Ollama served model: nomic-embed-text 2024-05-06 15:32:26 Creating Chroma vector store 2024-05-06 15:32:26 Initializing vector store retriever 2024-05-06 15:33:37 [nuxt] [request error] [unhandled] [500] Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-05-06 15:33:37 at Chroma.ensureCollection (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23)
2024-05-06 15:33:37 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-05-06 15:33:37 at async Chroma.addVectors (./.output/server/nodemodules/@langchain/community/dist/vectorstores/chroma.js:126:28)
2024-05-06 15:33:37 at async ingestDocument (./.output/server/chunks/
/rag.mjs:297:3)
2024-05-06 15:33:37 at async Object.handler (./.output/server/chunks/routes/api/index.post2.mjs:82:5)
2024-05-06 15:33:37 at async Object.handler (./.output/server/chunks/runtime.mjs:3125:19)
2024-05-06 15:33:37 at async Server.toNodeHandle (./.output/server/chunks/runtime.mjs:3391:7) 2024-05-06 15:40:10 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null }

NewSNode commented 4 months ago

运行环境: ChatOllama使用docker compose安装并运行,Ollama使用docker运行。 在Setting中配置本地Ollama的Host:http://host.docker.internal:11434。 操作方法: 登录ChatOllama; 创建本地知识库,Embedding使用Ollama的nomic-embed-text(已下载); 选择一个PDF文件,点击“save”按钮,查看ChatOllama后台日志,发现报错。 ChatOllama报错日志如下: 2024-04-28 12:21:01 URL: /api/auth/login User: null 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:02 URL: /api/knowledgebases User: {"id":1,"name":"xxx(我的实际值)","email":"xxxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:02 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:25 URL: /api/knowledgebases/5 User: {"id":1,"name":"xxxx(我的实际值)","email":"xxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:25 Ollama: { 2024-04-28 12:21:25 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:25 username: null, 2024-04-28 12:21:25 password: null 2024-04-28 12:21:25 } 2024-04-28 12:21:26 Knowledge base ID: 5 2024-04-28 12:21:26 Ollama: { 2024-04-28 12:21:26 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:26 username: null, 2024-04-28 12:21:26 password: null 2024-04-28 12:21:26 } 2024-04-28 12:21:26 Authorization: bnVsbDpudWxs 2024-04-28 12:21:26 Update knowledge base 工业互联网 with ID 5 2024-04-28 12:21:27 Creating embeddings for Ollama served model: nomic-embed-text 2024-04-28 12:21:27 Creating Chroma vector store 2024-04-28 12:21:27 Initializing ParentDocumentRetriever with RedisDocstore 2024-04-28 12:21:27 Redis client options: { host: 'redis', port: 6379, username: undefined, password: undefined } 2024-04-28 12:22:32 Error: Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (file:///app/.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (file:///app/.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (file:///app/.output/server/chunks/runtime.mjs:3391:7) 2024-04-28 12:22:32 [nuxt] [request error] [unhandled] [500] Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (./.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (./.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (./.output/server/chunks/runtime.mjs:3391:7) 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 其他信息补充: 1、使用Ollama下载到本地llama3模型可正常交互; 2、docker-compose.yaml文件内容(将Chromadb的端口改成了8300、ChatOllama镜像的端口改成了3300): version: '3.1' services: chromadb: image: chromadb/chroma ports: - "8300:8000" restart: always volumes: - chromadb_data:/chroma/.chroma/index chatollama: environment: - CHROMADB_URL=http://chromadb:8300 - DATABASE_URL=file:/app/sqlite/chatollama.sqlite - REDIS_HOST=redis image: 0001coder/chatollama:latest ports: - "3300:3000" pull_policy: always restart: always volumes: - ~/.chatollama:/app/sqlite redis: image: redis:latest restart: always volumes: - redis_data:/data volumes: chromadb_data: redis_data:

虽然对Chromadb做了端口映射,你在ChatOllama中的配置还是应该用8000端口

- CHROMADB_URL=http://chromadb:8000

这里用的是docker compose 服务构建的容器间网络的域名和端口。8300只是容器对外暴露的端口。 你更改 CHROMADB_URL 环境变量再试试

我的chromadb映射和容器端口都是8000,但还是一样的问题

麻烦问下,你的解决了吗?

suhengli commented 4 months ago

运行环境: ChatOllama使用docker compose安装并运行,Ollama使用docker运行。 在Setting中配置本地Ollama的Host:http://host.docker.internal:11434。 操作方法: 登录ChatOllama; 创建本地知识库,Embedding使用Ollama的nomic-embed-text(已下载); 选择一个PDF文件,点击“save”按钮,查看ChatOllama后台日志,发现报错。 ChatOllama报错日志如下: 2024-04-28 12:21:01 URL: /api/auth/login User: null 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:01 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:02 URL: /api/knowledgebases User: {"id":1,"name":"xxx(我的实际值)","email":"xxxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:02 Ollama: { host: 'http://127.0.0.1:11434', username: null, password: null } 2024-04-28 12:21:25 URL: /api/knowledgebases/5 User: {"id":1,"name":"xxxx(我的实际值)","email":"xxx(我的实际值)","role":"user","scope":["test","user"],"iat":1714278061,"exp":1745814061} 2024-04-28 12:21:25 Ollama: { 2024-04-28 12:21:25 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:25 username: null, 2024-04-28 12:21:25 password: null 2024-04-28 12:21:25 } 2024-04-28 12:21:26 Knowledge base ID: 5 2024-04-28 12:21:26 Ollama: { 2024-04-28 12:21:26 host: 'http://host.docker.internal:11434', 2024-04-28 12:21:26 username: null, 2024-04-28 12:21:26 password: null 2024-04-28 12:21:26 } 2024-04-28 12:21:26 Authorization: bnVsbDpudWxs 2024-04-28 12:21:26 Update knowledge base 工业互联网 with ID 5 2024-04-28 12:21:27 Creating embeddings for Ollama served model: nomic-embed-text 2024-04-28 12:21:27 Creating Chroma vector store 2024-04-28 12:21:27 Initializing ParentDocumentRetriever with RedisDocstore 2024-04-28 12:21:27 Redis client options: { host: 'redis', port: 6379, username: undefined, password: undefined } 2024-04-28 12:22:32 Error: Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (file:///app/.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (file:///app/.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (file:///app/.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (file:///app/.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (file:///app/.output/server/chunks/runtime.mjs:3391:7) 2024-04-28 12:22:32 [nuxt] [request error] [unhandled] [500] Chroma getOrCreateCollection error: Error: TypeError: fetch failed 2024-04-28 12:22:32 at Chroma.ensureCollection (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:99:23) 2024-04-28 12:22:32 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) 2024-04-28 12:22:32 at async Chroma.addVectors (./.output/server/node_modules/@langchain/community/dist/vectorstores/chroma.js:126:28) 2024-04-28 12:22:32 at async ParentDocumentRetriever.addDocuments (./.output/server/node_modules/langchain/dist/retrievers/parentdocument.js:167:13) 2024-04-28 12:22:32 at async ingestDocument (./.output/server/chunks//rag.mjs:297:3) 2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/routes/api/knowledgebases/id.put.mjs:60:7) 2024-04-28 12:22:32 at async Object.handler (./.output/server/chunks/runtime.mjs:3125:19) 2024-04-28 12:22:32 at async Server.toNodeHandle (./.output/server/chunks/runtime.mjs:3391:7) 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 各位大神,麻烦诊断下问题和解决方案,拜谢!!! 其他信息补充: 1、使用Ollama下载到本地llama3模型可正常交互; 2、docker-compose.yaml文件内容(将Chromadb的端口改成了8300、ChatOllama镜像的端口改成了3300): version: '3.1' services: chromadb: image: chromadb/chroma ports: - "8300:8000" restart: always volumes: - chromadb_data:/chroma/.chroma/index chatollama: environment: - CHROMADB_URL=http://chromadb:8300 - DATABASE_URL=file:/app/sqlite/chatollama.sqlite - REDIS_HOST=redis image: 0001coder/chatollama:latest ports: - "3300:3000" pull_policy: always restart: always volumes: - ~/.chatollama:/app/sqlite redis: image: redis:latest restart: always volumes: - redis_data:/data volumes: chromadb_data: redis_data:

虽然对Chromadb做了端口映射,你在ChatOllama中的配置还是应该用8000端口

- CHROMADB_URL=http://chromadb:8000

这里用的是docker compose 服务构建的容器间网络的域名和端口。8300只是容器对外暴露的端口。 你更改 CHROMADB_URL 环境变量再试试

我的chromadb映射和容器端口都是8000,但还是一样的问题

麻烦问下,你的解决了吗?

我的ollama也是docker-copose启动的,我这里是把所有服务的网络都弄到一个,就可以运行了。我之前是不运行redis的 如下是我chat-ollama的docker-compose.yml

services:
  chromadb:
    image: chromadb/chroma:0.5.0
    container_name: chromadb
    ports:
      - "8000:8000"
    # restart: always
    volumes:
      - ./chromadb_data:/chroma/index
    networks:
      - my-network-ollama

  chatollama:
    container_name: chatollama
    environment:
      - CHROMADB_URL=http://chromadb:8000
      - DATABASE_URL=file:/app/sqlite/chatollama.sqlite
      - REDIS_HOST=redis-7.2.4
      - DISABLE_VERCEL_ANALYTICS=false
      - OPENAI_API_KEY=
      - OLLAMA_URL=http://ollama:11434
    # image: 0001coder/chatollama:latest
    # image: 0001coder/chatollama:1714703221
    image: my-chat-ollama:0.0.1
    ports:
      - "3000:3000"
    # pull_policy: always
    # restart: always
    volumes:
      - ./chatollama_data:/app/sqlite
    # extra_hosts:
    #   - "ollama_server:ollama"
    networks:
      - my-network-ollama

  redis:
    container_name: redis-7.2.4
    image: redis:7.2.4
    ports:
      - "6379:6379"
    # restart: always
    volumes:
      - ./redis_data:/data
    networks:
      - my-network-ollama

volumes:
  chromadb_data:
  redis_data:

networks:
  my-network-ollama:
    # driver: bridge
    external: true

如下是我ollama的docker-compose.yml

services:
  ollama:
    image: ollama/ollama:0.1.33
    container_name: ollama
    ports:
      - 11434:11434
    volumes:
      - ./data/ollama:/root/.ollama
    networks:
      - my-network-ollama

networks:
  my-network-ollama:
    # driver: bridge
    external: true

my-chat-ollama:0.0.1 是我自己用源码打包的镜像

samisme0818 commented 4 months ago

也遇到同样问题 ollama是直接安装在mac上,chatollama是在同一台mac上docker部署的

cdrlover126 commented 1 month ago

也遇到同样问题 ollama是直接安装在mac上,chatollama是在同一台mac上docker部署的

情况相同,请问解决了没

sugarforever commented 1 month ago

也遇到同样问题 ollama是直接安装在mac上,chatollama是在同一台mac上docker部署的

情况相同,请问解决了没

请问你的运行环境时如何的?使用的代码仓库里的docker-compose.yaml吗?你可以尝试从ChatOllama容器里访问 http://chromadb:8000 ,先确保Chroma能正常访问