Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 知识库和大模型对话都没有返回message_id #5129

Closed
edwardlzh opened this issue Dec 9, 2024 · 8 comments
Closed

[BUG] 知识库和大模型对话都没有返回message_id #5129

edwardlzh opened this issue Dec 9, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@edwardlzh
Copy link

问题描述 / Problem Description
知识库和大模型对话都没有返回message_id。

预期的结果 / Expected Result
想实现本地知识库对话的评分功能。

实际结果 / Actual Result
评分接口需要message_id,看了下好像接口返回的message_id都为空

环境信息 / Environment Information

  • 0.3.1.3
  • 部署方式(pypi 安装 / 源码部署 / docker 部署):pypi installation
  • 使用的模型推理框架(Xinference / Ollama / OpenAI API 等):Xinference
  • 使用的 LLM 模型(GLM-4-9B / Qwen2-7B-Instruct 等):qwen1.5-14B
  • 使用的 Embedding 模型(bge-large-zh-v1.5 / m3e-base 等):bge-large-zh-v1.5
  • 使用的向量库类型 (faiss / milvus / pg_vector 等): faiss
  • 操作系统及版本 / Operating system and version: linux
  • Python 版本 / Python version: 3.9
  • 推理使用的硬件(GPU / CPU / MPS / NPU 等) / Inference hardware (GPU / CPU / MPS / NPU, etc.): GPU
  • 其他相关环境信息 / Other relevant environment information:

附加信息 / Additional Information
添加与问题相关的任何其他信息 / Add any other information related to the issue.

@edwardlzh edwardlzh added the bug Something isn't working label Dec 9, 2024
@948024326
Copy link

源码部署改一下

@edwardlzh
Copy link
Author

@948024326 你好,怎么改呢?有建议吗?

@edwardlzh
Copy link
Author

已解决

@yuezhupy
Copy link

已解决

@edwardlzh 请问怎么修改的呢?

@edwardlzh
Copy link
Author

已解决

@edwardlzh 请问怎么修改的呢?

@yuezhupy

  1. 用/chat/chat/completions接口,自定义传入conversation_id,这样响应可以返回message_id,并且能入库。
// libs/chatchat-server/chatchat/server/api_server/chat_routes.py:70
extra = {**body.model_extra} or {}
// libs/chatchat-server/chatchat/server/api_server/chat_routes.py:91
conversation_id = extra.get("conversation_id")
  1. /kb_chat接口想实现可能需要改代码吧,参考chatchat.server.db.repository.message_repository.add_message_to_db

@yuezhupy
Copy link

已解决

@edwardlzh 请问怎么修改的呢?

@yuezhupy

  1. 用/chat/chat/completions接口,自定义传入conversation_id,这样响应可以返回message_id,并且能入库。
// libs/chatchat-server/chatchat/server/api_server/chat_routes.py:70
extra = {**body.model_extra} or {}
// libs/chatchat-server/chatchat/server/api_server/chat_routes.py:91
conversation_id = extra.get("conversation_id")
  1. /kb_chat接口想实现可能需要改代码吧,参考chatchat.server.db.repository.message_repository.add_message_to_db
    @edwardlzh
    请问在/chat/chat/completions接口自定义的话是在输入的json中extra_body直接添加吗,方便给一个输入的用例吗

@edwardlzh
Copy link
Author

edwardlzh commented Dec 12, 2024

已解决

@edwardlzh 请问怎么修改的呢?

@yuezhupy

  1. 用/chat/chat/completions接口,自定义传入conversation_id,这样响应可以返回message_id,并且能入库。
// libs/chatchat-server/chatchat/server/api_server/chat_routes.py:70
extra = {**body.model_extra} or {}
// libs/chatchat-server/chatchat/server/api_server/chat_routes.py:91
conversation_id = extra.get("conversation_id")
  1. /kb_chat接口想实现可能需要改代码吧,参考chatchat.server.db.repository.message_repository.add_message_to_db
    @edwardlzh
    请问在/chat/chat/completions接口自定义的话是在输入的json中extra_body直接添加吗,方便给一个输入的用例吗

@yuezhupy

{
	"messages": [{
		"content": "xxxxxxx",
		"role": "user"
	}],
	"model": "qwen1.5-chat",
	"stream": true,
	"tool_choice": "search_local_knowledgebase",
	"tool_input": {
		"database": "",
		"query": "xxxxxxxx"
	},
	"conversation_id": "12345678912345678912345678912345" /* 32位*/
}

@yuezhupy
Copy link

@edwardlzh
谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants