UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

20 lines (15 loc) 856 B
import { ChatStreamPayload, UIChatMessage } from '@lobechat/types'; import { chatHistoryPrompts } from '../prompts'; export const chainSummaryHistory = (messages: UIChatMessage[]): Partial<ChatStreamPayload> => ({ messages: [ { content: `You're an assistant who's good at extracting key takeaways from conversations and summarizing them. Please summarize according to the user's needs. The content you need to summarize is located in the <chat_history> </chat_history> group of xml tags. The summary needs to maintain the original language.`, role: 'system', }, { content: `${chatHistoryPrompts(messages)} Please summarize the above conversation and retain key information. The summarized content will be used as context for subsequent prompts, and should be limited to 400 tokens.`, role: 'user', }, ], });