quivr [Bug]:使用ollama后端时出现空白响应

hrirmatl  于 6个月前  发布在  其他
关注(0)|答案(5)|浏览(78)

发生了什么?
当我尝试使用Quivr与Ollam qwen:72b模型时,聊天已经为空。日志或网页中没有显示错误。我检查了超级基础聊天历史表,助手文本为空:

相关日志输出

backend-core  | INFO:     127.0.0.1:51044 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:51088 - "GET /healthz HTTP/1.1" 200 OK
beat          | [2024-06-20 08:42:00,000: INFO/MainProcess] Scheduler: Sending due task process_premium_users (check_if_is_premium_user)
beat          | [2024-06-20 08:42:00,003: INFO/MainProcess] Scheduler: Sending due task process_sync_active (process_sync_active)
worker        | [2024-06-20 08:42:00,004: INFO/MainProcess] Task check_if_is_premium_user[ed7d1da4-7965-4b03-aa6c-d08f6d1b4953] received
worker        | [2024-06-20 08:42:00,009: INFO/MainProcess] Task process_sync_active[3e087e91-ba04-484a-8f1c-0d363f90dcc2] received
worker        | [2024-06-20 08:42:00,050: INFO/ForkPoolWorker-3] HTTP Request: GET http://host.docker.internal:54321/rest/v1/syncs_active?select=%2A&last_synced=lt.2024-06-20T02%3A42%3A00.012042 "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:42:00,059: INFO/ForkPoolWorker-3] HTTP Request: GET http://host.docker.internal:54321/rest/v1/syncs_active?select=%2A&force_sync=eq.True "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:42:00,062: INFO/ForkPoolWorker-3] Task process_sync_active[3e087e91-ba04-484a-8f1c-0d363f90dcc2] succeeded in 0.05039690800185781s: None
worker        | [2024-06-20 08:42:00,842: INFO/ForkPoolWorker-2] HTTP Request: GET http://host.docker.internal:54321/rest/v1/subscriptions?select=%2A&current_period_end=gt.2024-06-20%2010%3A42%3A00.006442 "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:42:01,493: INFO/ForkPoolWorker-2] HTTP Request: GET http://host.docker.internal:54321/rest/v1/customers?select=%2A&order=created.desc "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:42:01,501: INFO/ForkPoolWorker-2] HTTP Request: GET http://host.docker.internal:54321/rest/v1/product_to_features?select=%2A "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:42:01,508: INFO/ForkPoolWorker-2] HTTP Request: GET http://host.docker.internal:54321/rest/v1/users?select=id&email=eq.admin%40quivr.app "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:42:01,516: INFO/ForkPoolWorker-2] Task check_if_is_premium_user[ed7d1da4-7965-4b03-aa6c-d08f6d1b4953] succeeded in 1.5096762990033312s: True
backend-core  | INFO:     172.26.0.1:56690 - "GET /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56692 - "GET /chat HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56696 - "GET /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56694 - "GET /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56698 - "GET /brains/a0950bc4-0e84-4bb9-aecb-2aac255061da/ HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56694 - "GET /brains/ HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56822 - "GET /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56818 - "GET /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56828 - "GET /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56824 - "GET /chat HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56828 - "GET /brains/ HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56826 - "GET /brains/a0950bc4-0e84-4bb9-aecb-2aac255061da/ HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:51286 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56826 - "OPTIONS /chat/79148a96-9cb3-490f-ab32-c848b71eda35/question/stream?brain_id=a0950bc4-0e84-4bb9-aecb-2aac255061da HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56824 - "GET /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56828 - "GET /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56818 - "GET /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56826 - "POST /chat/79148a96-9cb3-490f-ab32-c848b71eda35/question/stream?brain_id=a0950bc4-0e84-4bb9-aecb-2aac255061da HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:51386 - "GET /healthz HTTP/1.1" 200 OK
beat          | [2024-06-20 08:43:00,000: INFO/MainProcess] Scheduler: Sending due task process_sync_active (process_sync_active)
worker        | [2024-06-20 08:43:00,004: INFO/MainProcess] Task process_sync_active[be12573f-e929-4138-ba8a-90ece81ffcd6] received
beat          | [2024-06-20 08:43:00,005: INFO/MainProcess] Scheduler: Sending due task process_premium_users (check_if_is_premium_user)
worker        | [2024-06-20 08:43:00,009: INFO/MainProcess] Task check_if_is_premium_user[7cbdd17c-492e-4c4e-a5cb-fea70cdfd3a1] received
worker        | [2024-06-20 08:43:00,016: INFO/ForkPoolWorker-2] HTTP Request: GET http://host.docker.internal:54321/rest/v1/syncs_active?select=%2A&last_synced=lt.2024-06-20T02%3A43%3A00.006841 "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:43:00,043: INFO/ForkPoolWorker-2] HTTP Request: GET http://host.docker.internal:54321/rest/v1/syncs_active?select=%2A&force_sync=eq.True "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:43:00,045: INFO/ForkPoolWorker-2] Task process_sync_active[be12573f-e929-4138-ba8a-90ece81ffcd6] succeeded in 0.03935996099971817s: None
redis         | 1:M 20 Jun 2024 08:43:00.096 * 100 changes in 300 seconds. Saving...
redis         | 1:M 20 Jun 2024 08:43:00.097 * Background saving started by pid 25
redis         | 25:C 20 Jun 2024 08:43:00.102 * DB saved on disk
redis         | 25:C 20 Jun 2024 08:43:00.102 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB
redis         | 1:M 20 Jun 2024 08:43:00.197 * Background saving terminated with success
worker        | [2024-06-20 08:43:00,709: INFO/ForkPoolWorker-3] HTTP Request: GET http://host.docker.internal:54321/rest/v1/subscriptions?select=%2A&current_period_end=gt.2024-06-20%2010%3A43%3A00.012100 "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:43:01,276: INFO/ForkPoolWorker-3] HTTP Request: GET http://host.docker.internal:54321/rest/v1/customers?select=%2A&order=created.desc "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:43:01,283: INFO/ForkPoolWorker-3] HTTP Request: GET http://host.docker.internal:54321/rest/v1/product_to_features?select=%2A "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:43:01,289: INFO/ForkPoolWorker-3] HTTP Request: GET http://host.docker.internal:54321/rest/v1/users?select=id&email=eq.admin%40quivr.app "HTTP/1.1 200 OK"
worker        | [2024-06-20 08:43:01,290: INFO/ForkPoolWorker-3] Task check_if_is_premium_user[7cbdd17c-492e-4c4e-a5cb-fea70cdfd3a1] succeeded in 1.278936637998413s: True
backend-core  | INFO:     172.26.0.1:57000 - "GET /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:57004 - "GET /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:57006 - "GET /brains/a0950bc4-0e84-4bb9-aecb-2aac255061da/ HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:56826 - "GET /user/credits HTTP/1.1" 200 OK
backend-core  | INFO:     172.26.0.1:57002 - "GET /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:51460 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:51522 - "GET /healthz HTTP/1.1" 200 OK
beat          | [2024-06-20 08:44:00,000: INFO/MainProcess] Scheduler: Sending due task process_premium_users (check_if_is_premium_user)
beat          | [2024-06-20 08:44:00,004: INFO/MainProcess] Scheduler: Sending due task process_sync_active (process_sync_active)

Twitter / LinkedIn详细信息

  • 无响应*
fquxozlt

fquxozlt1#

嘿,@travisgu!我在这里帮助你解决在使用Quivr时遇到的任何问题。我可以帮你解决bug、回答问题,甚至指导你如何成为项目的贡献者。让我们开始吧!
要解决在Quivr中使用Ollam qwen:72b模型时出现空白聊天响应的问题,请确保Supabase聊天历史表中的promptassistant列被正确填充。以下是解决此问题的步骤:

  1. 检查generate_streamgenerate_answer方法:确保这些方法正确地将响应保存到数据库中。
  2. 更新save_answer方法:确保此方法正确地更新Supabase聊天历史表中的promptassistant列。
    以下是如何更新save_answer方法的示例:
def save_answer(self, question, response_tokens, streamed_chat_history, save_answer):
    # Combine response tokens into a single response
    response = ''.join(response_tokens)
    
    # Update the chat history with the response
    streamed_chat_history.assistant = response
    
    # Save the chat history to the database
    if save_answer:
        chat_service.save_chat_history(
            chat_id=question.chat_id,
            question=question.question,
            answer=response,
            prompt=streamed_chat_history.prompt,
            assistant=streamed_chat_history.assistant
        )
  1. 验证.env配置:确保OLLAMA_API_BASE_URL未被注解且正确指向Ollama API的本地URL:
# LOCAL
OLLAMA_API_BASE_URL=http://host.docker.internal:11434# Uncomment to activate ollama. This is the local url for the ollama api
  1. 添加额外的日志记录:如果问题仍然存在,请添加日志以追踪数据可能丢失或未正确保存的位置。
    确保backend/modules/brain/qa_headless.py文件中的generate_answergenerate_stream方法正确处理聊天历史更新并将响应保存到数据库1(https://github.com/QuivrHQ/quivr/blob/main/backend/modules/brain/integrations/Self/Brain.py)2(https://github.com/QuivrHQ/quivr/blob/main/backend/modules/brain/qa_headless.py)3(https://github.com/QuivrHQ/quivr/blob/main/.env.example)中。
  • 要继续与Dosu交谈,请提及@dosu。*
bmp9r5qi

bmp9r5qi2#

我没有修改任何代码,并使用docker镜像运行quivr。URL配置是正确的。我在Ollama日志文件中可以看到提示,并且Ollama对API调用返回200。@dosu

wqnecbli

wqnecbli3#

你使用的模型名称是什么?我发现它应该以 ollama/ 为前缀。

tktrz96b

tktrz96b4#

你使用的模型名称是什么?我发现它应该以 ollama/ 为前缀。
对的,模型名称是“ollama/qwen:72b”。

nzk0hqpo

nzk0hqpo5#

顺便说一下,我正在使用Quivr和Docker Compose在我的笔记本电脑上运行,我不确定这是否是原因。

相关问题