Comments (2)
To include historical chat logs in a knowledge base document, you'll need to modify your code, specifically focusing on how historical chat logs are collected, formatted, and included in the knowledge base documents. Here's a concise guide:
-
Collect and Format Historical Chat Logs: Utilize the
history
parameter in functions likefile_chat
to gather dialogue history. Ensure the logs are correctly formatted for inclusion in knowledge base documents. -
Modify Knowledge Base Dialogue Templates: Adjust your knowledge base document templates to incorporate historical chat logs. This involves modifying the template code to include the
history
variable, ensuring it's passed as part of the prompt to the language model. -
Code Adjustments for Historical Context: In the code that generates prompts for knowledge base documents, include the
history
variable. This ensures that the language model has access to the historical chat logs when generating responses. -
Implement User Commands for History Management: Add functionality to allow users to manage how historical logs are used, such as commands to clear or export history. This enhances the flexibility and user control over the inclusion of historical data in knowledge base documents.
By following these steps and making the necessary code adjustments, you can effectively incorporate historical chat logs into your knowledge base documents, enriching the context and relevance of the information provided.
Details
Sources
- 知识库没有多轮对话能力
- 如何提升知识库对话文档检索的准确率
- 知识库对话的聊天记录信息未添加到message表中
- 在knowledge_base_chat.py中knowledge_base_chat函数有一行代码是 input_msg = History(role="user", content=prompt_template).to_msg_template(False) chat_prompt = ChatPromptTemplate.from_messages( [i.to_msg_template() for i in history] + [input_msg]) 这里既把历史信息放入prompt中,又把默认的模板加入prompt中,是否合理
- knowledge_base_chat.py将默认模板和history放在一起作为prompt,但这里面默认的prompt模板和history并不匹配,暴力的放在一起会不会有问题,是否要更换模板或者更换历史信息的提问方式?目前没有看到默认模板中{{context}}{{question}}标签与history中的其他标签有对应关系
- 体验chatchat遇到的问题汇总
- server/chat/knowledge_base_chat.py
- webui_pages/dialogue/dialogue.py
- configs/prompt_config.py.example
- server/chat/file_chat.py
- markdown_docs/server/chat/file_chat.md
- server/chat/chat.py
- server/chat/utils.py
- chains/llmchain_with_history.py
- markdown_docs/server/memory/conversation_db_buffer_memory.md
- server/memory/conversation_db_buffer_memory.py
- server/chat/agent_chat.py
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from langchain-chatchat.
@666yiyoung666 可以参考这个issue #3883 的解答。
from langchain-chatchat.
Related Issues (20)
- [BUG]httpcore.RemoteProtocolError: peer closed connection without sending complete message body (incomplete chunked read)
- 配置好vllm配置之后启动startup.py时候遇到一个问题,似乎是缺少一个参数配置,具体报错如下
- 运行后卡柱不动
- 在初始化过程中,显存爆了 HOT 1
- 知识库匹配需要原文回答,而不是润色的内容
- 这个项目中的fastapi 怎么在vscode 调试时 重载代码? uvicorn --reload时报错
- 知识库问答调用add_message_to_db 无法保存response
- UnstructuredMarkdownLoader会丢失Markdown的结构标识
- 怎么使用splite
- [FEATURE] 搜索引擎支持百度api
- 请问怎么看最后传给大模型的历史对话和用户询问,我目前只跟踪到以下部分。
- http://127.0.0.1:7861/knowledge_base/kb_summary_api/summary_file_to_vector_store 进行文件总结 响应7分钟后出现一下报错,是超时了吗,这个逻辑是在哪啊,
- 上传文件不支持json格式的吗,似乎上传后解析不了
- 问答的第二个问题就会卡住中断
- cannot import name 'PDFResourceManag er' from 'pdfminer.converter'这是什么错误[BUG] 简洁阐述问题 / Concise description of the issue HOT 1
- 如何同时接入多个封装好的openai api格式大模型 HOT 2
- 请问怎么计算输出的token数量?这个框架有现成支持的方法吗
- 调用讯飞星火api,没有输出回答 HOT 2
- [BUG] 知识库问答匹配不到/ Concise description of the issue HOT 2
- 是否可以支持用户中断模型输出
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from langchain-chatchat.