chatchat-space / Langchain-Chatchat

Langchain-Chatchat(原Langchain-ChatGLM)基于 Langchain 与 ChatGLM, Qwen 与 Llama 等语言模型的 RAG 与 Agent 应用 | Langchain-Chatchat (formerly langchain-ChatGLM), local knowledge based LLM (like ChatGLM, Qwen and Llama) RAG and Agent app with langchain
Apache License 2.0
31.09k stars 5.43k forks source link

vue前端如何使用流式输出 #894

Closed zhangyuwaitao closed 1 year ago

zhangyuwaitao commented 1 year ago

功能描述 / Feature Description 用简洁明了的语言描述所需的功能 / Describe the desired feature in a clear and concise manner.

解决的问题 / Problem Solved 解释此功能如何解决现有问题或改进项目 / Explain how this feature solves existing problems or improves the project.

实现建议 / Implementation Suggestions 如果可能,请提供关于如何实现此功能的建议 / If possible, provide suggestions on how to implement this feature.

替代方案 / Alternative Solutions 描述您考虑过的替代方案 / Describe alternative solutions you have considered.

其他信息 / Additional Information 添加与功能请求相关的任何其他信息 / Add any other information related to the feature request.

Rick-24 commented 1 year ago

mounted() { this.socket = new WebSocket("ws://82.157.118.175:43360" + "/local_doc_qa/stream_chat") this.socket.onopen = this.open this.socket.onmessage = this.getMessage this.socket.close = this.close },

Rick-24 commented 1 year ago

发送消息使用

 this.socket.send(JSON.stringify({
          "knowledge_base_id": process.env.VUE_APP_KGQA_KNOWLEDGE_BASE_ID,
          "question": chatMsg.msg,
          "history": []
        }))
imClumsyPanda commented 1 year ago

项目已更新至v0.2.x版本,暂未提供vue版本前端,但api中对话接口已全部支持流式/非流式输出,可以在fastapi的docs中进行测试,感谢反馈!

Bo-LiangD commented 5 months ago

平台 socket有对外提供嘛, 可以直接使用langchat 中的socket嘛

Bo-LiangD commented 5 months ago

0.2.10版本的