@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.
22 lines (18 loc) • 735 B
text/typescript
import { globalHelpers } from '@/store/global/helpers';
import { ChatStreamPayload, OpenAIChatMessage } from '@/types/openai/chat';
export const chainSummaryTitle = (messages: OpenAIChatMessage[]): Partial<ChatStreamPayload> => {
const lang = globalHelpers.getCurrentLanguage();
return {
messages: [
{
content: '你是一名擅长会话的助理,你需要将用户的会话总结为 10 个字以内的标题',
role: 'system',
},
{
content: `${messages.map((message) => `${message.role}: ${message.content}`).join('\n')}
请总结上述对话为10个字以内的标题,不需要包含标点符号,输出语言语种为:${lang}`,
role: 'user',
},
],
};
};