mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 15:46:39 +08:00
Fix & Feat UI Page Chat [Json Exporter]
[+] fix(exporter.tsx): remove system message in JsonPreviewer component [+] feat(chat.ts): add system message after updating current session topic for all models
This commit is contained in:
parent
9ed113b52b
commit
18175d4d6a
@ -619,10 +619,6 @@ export function JsonPreviewer(props: {
|
||||
}) {
|
||||
const msgs = {
|
||||
messages: [
|
||||
{
|
||||
role: "system",
|
||||
content: `${Locale.FineTuned.Sysmessage} ${props.topic}`,
|
||||
},
|
||||
...props.messages.map((m) => ({
|
||||
role: m.role,
|
||||
content: m.content,
|
||||
|
@ -519,10 +519,18 @@ export const useChatStore = createPersistStore(
|
||||
},
|
||||
onFinish(message) {
|
||||
get().updateCurrentSession(
|
||||
(session) =>
|
||||
(session.topic =
|
||||
message.length > 0 ? trimTopic(message) : DEFAULT_TOPIC),
|
||||
);
|
||||
(session) => {
|
||||
session.topic =
|
||||
message.length > 0 ? trimTopic(message) : DEFAULT_TOPIC;
|
||||
// Add system message after summarizing the topic
|
||||
const systemMessage: ChatMessage = {
|
||||
role: "system",
|
||||
content: `${Locale.FineTuned.Sysmessage} ${session.topic}`,
|
||||
date: new Date().toLocaleString(),
|
||||
id: nanoid(),
|
||||
};
|
||||
session.messages = [systemMessage, ...session.messages];
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user