52 lines
1.4 KiB
Vue
52 lines
1.4 KiB
Vue
<template>
|
|
<ChatBox
|
|
:character-config="characterConfig"
|
|
:ai-config="aiConfig"
|
|
/>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, onMounted } from 'vue';
|
|
import ChatBox from '@/components/ChatBox.vue';
|
|
|
|
// 角色配置
|
|
const characterConfig = ref({});
|
|
|
|
// AI 配置
|
|
const aiConfig = ref({
|
|
modelId: 10,
|
|
templateId: 6
|
|
});
|
|
|
|
// 初始化:解析 URL 参数
|
|
onMounted(() => {
|
|
const pages = getCurrentPages();
|
|
const currentPage = pages[pages.length - 1];
|
|
const options = currentPage.options || {};
|
|
|
|
// 组装角色配置
|
|
characterConfig.value = {
|
|
id: options.characterId || '',
|
|
roleId: options.roleId || '',
|
|
name: decodeURIComponent(options.roleName || 'AI角色'),
|
|
avatar: decodeURIComponent(options.avatar || '/static/logo.png'),
|
|
greeting: decodeURIComponent(options.greeting || '你好!很高兴认识你!'),
|
|
roleDesc: decodeURIComponent(options.roleDesc || '')
|
|
};
|
|
|
|
// 组装 AI 配置
|
|
aiConfig.value = {
|
|
modelId: options.modelId ? parseInt(options.modelId) : 10,
|
|
templateId: options.templateId ? parseInt(options.templateId) : (options.roleId ? parseInt(options.roleId) : 6),
|
|
ttsId: options.ttsId || null,
|
|
sttId: options.sttId || null,
|
|
temperature: options.temperature ? parseFloat(options.temperature) : 0.7,
|
|
topP: options.topP ? parseFloat(options.topP) : 0.9
|
|
};
|
|
});
|
|
</script>
|
|
|
|
<style scoped>
|
|
/* 无需额外样式,所有样式在 ChatBox 组件中 */
|
|
</style>
|