添加意见反馈配置,控制对话评价是否显示

This commit is contained in:
sophie committed 2026-04-22 16:22:23 +08:00
1 parent ef0ae7fe08
commit 2bd27ed70d
2 files changed
+10 -9

No files matched your search

+4 -3
View File
@@ -1,4 +1,4 @@
export const config = { export const config = {
appTitle: 'AI工作台', appTitle: 'AI工作台',
auth: { auth: {
wecom: { wecom: {
@@ -12,13 +12,14 @@ export const config = {
} }
}, },
workspace: { workspace: {
enableFeedback: true, // true 显示评分区;false 隐藏评分区
showChatRating: false,
// 聊天窗口“源文件展示”开关配置 // 聊天窗口“源文件展示”开关配置
sourceFiles: { sourceFiles: {
// 是否显示源文件区域(包含上方文件按钮 + 下方“源文档”详情) // 是否显示源文件区域(包含上方文件按钮 + 下方“源文档”详情)
showSourceFiles: true, showSourceFiles: true,
// 是否显示 MD 源文件(文件名后缀为 .md/.markdown) // 是否显示 MD 源文件(文件名后缀为 .md/.markdown)
showMdFiles: true, showMdFiles: false,
// 当 showMdFiles=true 时,MD 源文件是否默认展开“源文档”详情 // 当 showMdFiles=true 时,MD 源文件是否默认展开“源文档”详情
expandMdByDefault: false, expandMdByDefault: false,
}, },
+6 -6
View File
@@ -1,4 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
/** /**
@@ -528,17 +528,17 @@ onMounted(async () => {
handleSend(); handleSend();
} }
// Use config from config.ts instead of API // Use config from config.ts instead of API
enableFeedback.value = config.workspace.enableFeedback; showChatRating.value = config.workspace.showChatRating;
}); });
/** /**
* 反馈相关状态 * 反馈相关状态
* enableFeedback:是否启用评分功能(后续可接入配置) * showChatRating:是否启用评分功能(后续可接入配置)
* rating:用户选择的评分(1-5) * rating:用户选择的评分(1-5)
* feedbackComment:用户输入的文字意见 * feedbackComment:用户输入的文字意见
* feedbackSubmitted:是否已经提交反馈 * feedbackSubmitted:是否已经提交反馈
*/ */
const enableFeedback = ref(true); const showChatRating = ref(false);
const rating = ref<number | null>(null); const rating = ref<number | null>(null);
const feedbackComment = ref(''); const feedbackComment = ref('');
const feedbackSubmitted = ref(false); const feedbackSubmitted = ref(false);
@@ -548,7 +548,7 @@ const feedbackSubmitted = ref(false);
* 用途:将评分与评论提交到后端 /api/chat/feedback * 用途:将评分与评论提交到后端 /api/chat/feedback
*/ */
const submitFeedback = async () => { const submitFeedback = async () => {
if (!enableFeedback.value || feedbackSubmitted.value) return; if (!showChatRating.value || feedbackSubmitted.value) return;
if (!rating.value) { if (!rating.value) {
showMessageDialog('warning', t('chat.feedback.selectRating')); showMessageDialog('warning', t('chat.feedback.selectRating'));
return; return;
@@ -841,7 +841,7 @@ const submitFeedback = async () => {
</div> </div>
<div <div
v-if="enableFeedback && messages.length > 0 && !isThinking" v-if="showChatRating && messages.length > 0 && !isThinking"
class="mx-auto mt-8 max-w-5xl border-t border-slate-200/80 pt-8 dark:border-slate-700/70" class="mx-auto mt-8 max-w-5xl border-t border-slate-200/80 pt-8 dark:border-slate-700/70"
> >
<div class="glass-panel flex flex-col items-center gap-4 rounded-2xl p-6"> <div class="glass-panel flex flex-col items-center gap-4 rounded-2xl p-6">