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

知识库问答模式调用流式API,返回的结果中冗余重复的docs内容是否需要优化下 #1431

Closed
zoidburg opened this issue Sep 11, 2023 · 1 comment
Assignees

Comments

@zoidburg
Copy link

zoidburg commented Sep 11, 2023

在知识库问答模式调用流式API时,将以event stream的形式返回生成结果;其中有answer和docs两个字段,分别对应生成token和知识库reference信息。返回各个token时,对应的docs字段内容是冗余的
knowledge_base_chat.py代码中对应处理逻辑:

if stream:
    async for token in callback.aiter():
    # Use server-sent-events to stream the response
        yield json.dumps({"answer": token, "docs": source_documents},  ensure_ascii=False)

生成每个token都对应相同的source_documents值,是否需要优化下不返回重复冗余的docs内容

@liunux4odoo liunux4odoo self-assigned this Sep 11, 2023
liunux4odoo added a commit to liunux4odoo/Langchain-Chatchat that referenced this issue Sep 12, 2023
1. fix chatchat-space#1431: 优化知识库问答与搜索引擎问答的API接口,避免docs重复返回
2. startup.py根据configs.log_verbose控制log级别
3. 修复/llm_model/list_models的bug:
   只有一个参数时,fastapi未返回json导致视图函数出错
liunux4odoo added a commit that referenced this issue Sep 12, 2023
1. fix #1431: 优化知识库问答与搜索引擎问答的API接口,避免docs重复返回
2. startup.py根据configs.log_verbose控制log级别
3. 修复/llm_model/list_models的bug:
   只有一个参数时,fastapi未返回json导致视图函数出错
@liunux4odoo
Copy link
Collaborator

开发版中已修复该问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants