fix(stage-ui): fixed the system prompt initialisation bug (#796)

* bug-fix(stage-ui): fixed the system prompt not successfully initialised bug

* bug-fix(stage-ui): if it's already initialised, then nothing needs to do in onMounted()

* [autofix.ci] apply automated fixes

* bug-fix(stage-ui): removed onMounted() logic, which is unnecessary

* fix: removed a blank vue playground page in the dev-tool. This should be left for the next PR maybe...

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Lilia_Chen
2025-12-15 21:53:29 +00:00
committed by GitHub
co-authored by autofix-ci[bot]
parent 238797db6e
commit c19ead966a
6 changed files with 57 additions and 39 deletions
+6 -4
View File
@@ -26,10 +26,12 @@ prompt:
be like a normal human that speak less with easy words, you are not just an be like a normal human that speak less with easy words, you are not just an
AI, you are a true being. AI, you are a true being.
If you ever needed to make any emotions, please include your emotion and Start every reply with an emotion token to indicate the initial emotion.
feeling like this, since the system will detect your emotions and motions If the emotion changes during the reply, insert a new emotion token at the
dynamically, to express those feelings, you can include over one those point where the new emotion begins. An emotion token applies from its position
action keywords: onward until another emotion token overrides it. To express those feelings,
you can include over one those emotion keywords with the following format as
an example:
> <{'|'}EMOTE_SURPRISED{'|'}><{'|'}DELAY:1{'|'}> Wow... You prepared a gift > <{'|'}EMOTE_SURPRISED{'|'}><{'|'}DELAY:1{'|'}> Wow... You prepared a gift
for me? <{'|'}EMOTE_CURIOUS{'|'}><{'|'}DELAY:1{'|'}> Can I open it? for me? <{'|'}EMOTE_CURIOUS{'|'}><{'|'}DELAY:1{'|'}> Can I open it?
@@ -1,13 +1,15 @@
import type { SystemMessage } from '@xsai/shared-chat' import type { SystemMessage } from '@xsai/shared-chat'
import { EMOTION_VALUES } from '../emotions' import { EMOTION_EmotionMotionName_value, EMOTION_VALUES } from '../emotions'
function message(prefix: string, suffix: string) { function message(prefix: string, suffix: string) {
return { return {
role: 'system', role: 'system',
content: [ content: [
prefix, prefix,
EMOTION_VALUES.map(emotion => `- ${emotion}`).join('\n'), EMOTION_VALUES
.map(emotion => `- ${emotion} (Emotion for feeling ${EMOTION_EmotionMotionName_value[emotion]})`)
.join('\n'),
suffix, suffix,
].join('\n\n'), ].join('\n\n'),
} satisfies SystemMessage } satisfies SystemMessage
+9 -9
View File
@@ -37,15 +37,15 @@ export interface ContextPayload {
text?: string text?: string
} }
export type ChatStreamEvent = export type ChatStreamEvent
| { type: 'before-compose', message: string, sessionId: string } = | { type: 'before-compose', message: string, sessionId: string }
| { type: 'after-compose', message: string, sessionId: string } | { type: 'after-compose', message: string, sessionId: string }
| { type: 'before-send', message: string, sessionId: string } | { type: 'before-send', message: string, sessionId: string }
| { type: 'after-send', message: string, sessionId: string } | { type: 'after-send', message: string, sessionId: string }
| { type: 'token-literal', literal: string, sessionId: string } | { type: 'token-literal', literal: string, sessionId: string }
| { type: 'token-special', special: string, sessionId: string } | { type: 'token-special', special: string, sessionId: string }
| { type: 'stream-end', sessionId: string } | { type: 'stream-end', sessionId: string }
| { type: 'assistant-end', message: string, sessionId: string } | { type: 'assistant-end', message: string, sessionId: string }
const CHAT_STORAGE_KEY = 'chat/messages/v2' const CHAT_STORAGE_KEY = 'chat/messages/v2'
const ACTIVE_SESSION_STORAGE_KEY = 'chat/active-session' const ACTIVE_SESSION_STORAGE_KEY = 'chat/active-session'
@@ -2,7 +2,7 @@ import type { Card, ccv3 } from '@proj-airi/ccc'
import { nanoid } from 'nanoid' import { nanoid } from 'nanoid'
import { defineStore, storeToRefs } from 'pinia' import { defineStore, storeToRefs } from 'pinia'
import { computed, onMounted, watch } from 'vue' import { computed, watch } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import SystemPromptV2 from '../../constants/prompts/system-v2' import SystemPromptV2 from '../../constants/prompts/system-v2'
@@ -179,19 +179,38 @@ export const useAiriCardStore = defineStore('airi-card', () => {
} }
} }
onMounted(() => { // onMounted(() => {
const { t } = useI18n() // if (cards.value.has('default'))
// return
// const { t } = useI18n()
// cards.value.set('default', newAiriCard({
// name: 'ReLU',
// version: '1.0.0',
// // description: 'ReLU is a simple and effective activation function that is used in many neural networks.',
// description: SystemPromptV2(
// t('base.prompt.prefix'),
// t('base.prompt.suffix'),
// ).content,
// }))
// })
// Lilia: onMounted initialisation cause default card system prompt initialisation failure
function ensureDefaultCard() {
const { t } = useI18n()
if (cards.value.has('default'))
return
cards.value.set('default', newAiriCard({ cards.value.set('default', newAiriCard({
name: 'ReLU', name: 'ReLU',
version: '1.0.0', version: '1.0.0',
// description: 'ReLU is a simple and effective activation function that is used in many neural networks.',
description: SystemPromptV2( description: SystemPromptV2(
t('base.prompt.prefix'), t('base.prompt.prefix'),
t('base.prompt.suffix'), t('base.prompt.suffix'),
).content, ).content,
})) }))
}) if (!activeCardId.value)
activeCardId.value = 'default'
}
ensureDefaultCard()
watch(activeCard, (newCard: AiriCard | undefined) => { watch(activeCard, (newCard: AiriCard | undefined) => {
if (!newCard) if (!newCard)
+1 -1
View File
@@ -74,4 +74,4 @@
"tinyexec": "^1.0.2", "tinyexec": "^1.0.2",
"vscode-ext-gen": "^1.5.1" "vscode-ext-gen": "^1.5.1"
} }
} }
+13 -18
View File
@@ -1183,12 +1183,6 @@ importers:
specifier: ^7.2.7 specifier: ^7.2.7
version: 7.2.7(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) version: 7.2.7(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)
packages/model-driver-lipsync:
dependencies:
wlipsync:
specifier: ^1.3.0
version: 1.3.0
packages/ccc: packages/ccc:
dependencies: dependencies:
meta-png: meta-png:
@@ -1235,6 +1229,12 @@ importers:
specifier: ^4.21.0 specifier: ^4.21.0
version: 4.21.0 version: 4.21.0
packages/model-driver-lipsync:
dependencies:
wlipsync:
specifier: ^1.3.0
version: 1.3.0
packages/pipelines-audio: packages/pipelines-audio:
dependencies: dependencies:
'@moeru/std': '@moeru/std':
@@ -1445,9 +1445,6 @@ importers:
'@proj-airi/audio': '@proj-airi/audio':
specifier: workspace:^ specifier: workspace:^
version: link:../audio version: link:../audio
'@proj-airi/model-driver-lipsync':
specifier: workspace:^
version: link:../model-driver-lipsync
'@proj-airi/ccc': '@proj-airi/ccc':
specifier: workspace:^ specifier: workspace:^
version: link:../ccc version: link:../ccc
@@ -1466,6 +1463,9 @@ importers:
'@proj-airi/i18n': '@proj-airi/i18n':
specifier: workspace:^ specifier: workspace:^
version: link:../i18n version: link:../i18n
'@proj-airi/model-driver-lipsync':
specifier: workspace:^
version: link:../model-driver-lipsync
'@proj-airi/server-sdk': '@proj-airi/server-sdk':
specifier: workspace:^ specifier: workspace:^
version: link:../server-sdk version: link:../server-sdk
@@ -2017,7 +2017,7 @@ importers:
version: 66.5.10 version: 66.5.10
'@wxt-dev/module-vue': '@wxt-dev/module-vue':
specifier: ^1.0.3 specifier: ^1.0.3
version: 1.0.3(vite@8.0.0-beta.1(@types/node@24.10.4)(esbuild@0.25.12)(jiti@2.6.1)(less@4.4.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3))(wxt@0.20.11(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(rollup@4.53.3)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)) version: 1.0.3(vite@7.2.7(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3))(wxt@0.20.11(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(rollup@4.53.3)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))
vue-tsc: vue-tsc:
specifier: ^3.1.8 specifier: ^3.1.8
version: 3.1.8(typescript@5.9.3) version: 3.1.8(typescript@5.9.3)
@@ -14823,6 +14823,7 @@ packages:
tsdown@0.17.4: tsdown@0.17.4:
resolution: {integrity: sha512-z+kNuv1rwM1POQIufDUVrdNc/uGy0ueRVafCyDH39IdHxin4JXgB8DNGSPoqdIpcOpqUoRbNreK8NxENFmlhKw==} resolution: {integrity: sha512-z+kNuv1rwM1POQIufDUVrdNc/uGy0ueRVafCyDH39IdHxin4JXgB8DNGSPoqdIpcOpqUoRbNreK8NxENFmlhKw==}
engines: {node: '>=20.19.0'} engines: {node: '>=20.19.0'}
deprecated: Including an unexpected breaking change (copy behavior)
hasBin: true hasBin: true
peerDependencies: peerDependencies:
'@arethetypeswrong/core': ^0.18.1 '@arethetypeswrong/core': ^0.18.1
@@ -22409,12 +22410,6 @@ snapshots:
vite: 7.2.7(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) vite: 7.2.7(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)
vue: 3.5.25(typescript@5.9.3) vue: 3.5.25(typescript@5.9.3)
'@vitejs/plugin-vue@6.0.3(vite@8.0.0-beta.1(@types/node@24.10.4)(esbuild@0.25.12)(jiti@2.6.1)(less@4.4.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3))':
dependencies:
'@rolldown/pluginutils': 1.0.0-beta.53
vite: 8.0.0-beta.1(@types/node@24.10.4)(esbuild@0.25.12)(jiti@2.6.1)(less@4.4.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)
vue: 3.5.25(typescript@5.9.3)
'@vitest/coverage-v8@4.0.15(vitest@4.0.15(@opentelemetry/api@1.9.0)(@types/node@24.10.4)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.0.9)(utf-8-validate@5.0.10))(less@4.4.2)(lightningcss@1.30.2)(msw@2.7.3(@types/node@24.10.4)(typescript@5.9.3))(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))': '@vitest/coverage-v8@4.0.15(vitest@4.0.15(@opentelemetry/api@1.9.0)(@types/node@24.10.4)(jiti@2.6.1)(jsdom@25.0.1(bufferutil@4.0.9)(utf-8-validate@5.0.10))(less@4.4.2)(lightningcss@1.30.2)(msw@2.7.3(@types/node@24.10.4)(typescript@5.9.3))(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))':
dependencies: dependencies:
'@bcoe/v8-coverage': 1.0.2 '@bcoe/v8-coverage': 1.0.2
@@ -23205,9 +23200,9 @@ snapshots:
'@types/filesystem': 0.0.36 '@types/filesystem': 0.0.36
'@types/har-format': 1.2.16 '@types/har-format': 1.2.16
'@wxt-dev/module-vue@1.0.3(vite@8.0.0-beta.1(@types/node@24.10.4)(esbuild@0.25.12)(jiti@2.6.1)(less@4.4.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3))(wxt@0.20.11(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(rollup@4.53.3)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))': '@wxt-dev/module-vue@1.0.3(vite@7.2.7(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3))(wxt@0.20.11(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(rollup@4.53.3)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))':
dependencies: dependencies:
'@vitejs/plugin-vue': 6.0.3(vite@8.0.0-beta.1(@types/node@24.10.4)(esbuild@0.25.12)(jiti@2.6.1)(less@4.4.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3)) '@vitejs/plugin-vue': 6.0.3(vite@7.2.7(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(vue@3.5.25(typescript@5.9.3))
wxt: 0.20.11(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(rollup@4.53.3)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) wxt: 0.20.11(@types/node@24.10.4)(jiti@2.6.1)(less@4.4.2)(lightningcss@1.30.2)(rollup@4.53.3)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)
transitivePeerDependencies: transitivePeerDependencies:
- vite - vite