diff --git a/app/components/exporter.module.scss b/app/components/exporter.module.scss index 5e992e7fd..927409064 100644 --- a/app/components/exporter.module.scss +++ b/app/components/exporter.module.scss @@ -252,6 +252,12 @@ } } + &-system { + .body { + background-color: var(--white); + } + } + &-user { flex-direction: row-reverse; diff --git a/app/components/exporter.tsx b/app/components/exporter.tsx index aba8dc544..35be63c8e 100644 --- a/app/components/exporter.tsx +++ b/app/components/exporter.tsx @@ -568,15 +568,22 @@ export function ImagePreviewer(props: { {props.messages.map((m, i) => { + const isUserMessage = m.role === "user"; + const isSystemMessage = m.role === "system"; + const avatar = + isUserMessage && config.avatar + ? config.avatar + : isSystemMessage + ? "2699-fe0f" + : mask.avatar; + const messageClass = `${styles["message"]} ${ + styles["message-" + m.role] + }`; + return ( -
+
- +
@@ -665,10 +672,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, diff --git a/app/store/chat.ts b/app/store/chat.ts index 6900899e1..d42b277f1 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -652,10 +652,19 @@ export const useChatStore = createPersistStore( onFinish(message) { if (!isValidMessage(message)) return; 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 + // which is powerful based of fine-tuning + const systemMessage: ChatMessage = { + date: new Date().toLocaleString(), + id: nanoid(), + role: "system", + content: `${Locale.FineTuned.Sysmessage} ${session.topic}`, + }; + session.messages = [systemMessage, ...session.messages]; + }); }, }); }