From 1ac663fc3f7ddd53bf2f4e2bc3a4305c81109428 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Mon, 22 Dec 2025 12:11:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86placeholder=E5=8A=A8=E6=80=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E6=94=AF=E6=8C=81=E5=9F=BA=E4=BA=8E?= =?UTF-8?q?=E7=9F=A5=E8=AF=86=E5=BA=93=E5=92=8C=E7=BD=91=E7=BB=9C=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=8A=B6=E6=80=81=E7=9A=84=E4=B8=AA=E6=80=A7=E5=8C=96?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Input-field.vue | 22 ++++- frontend/src/i18n/locales/en-US.ts | 4 +- frontend/src/i18n/locales/ru-RU.ts | 4 +- frontend/src/i18n/locales/zh-CN.ts | 4 +- frontend/src/stores/menu.ts | 5 +- frontend/src/views/chat/components/botmsg.vue | 91 +++++++++++++++++++ frontend/src/views/chat/index.vue | 18 +++- frontend/src/views/creatChat/creatChat.vue | 12 +-- 8 files changed, 146 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/Input-field.vue b/frontend/src/components/Input-field.vue index 58151851..28077bac 100644 --- a/frontend/src/components/Input-field.vue +++ b/frontend/src/components/Input-field.vue @@ -121,6 +121,26 @@ const { t } = useI18n(); const displayedKbs = computed(() => selectedKbs.value.slice(0, 2)); const remainingCount = computed(() => Math.max(0, selectedKbs.value.length - 2)); +// 根据不同状态组合计算输入框的 placeholder +const inputPlaceholder = computed(() => { + const hasKnowledge = allSelectedItems.value.length > 0; + const hasWebSearch = isWebSearchEnabled.value && isWebSearchConfigured.value; + + if (hasKnowledge && hasWebSearch) { + // 有知识库 + 有网络搜索 + return t('input.placeholderKbAndWeb'); + } else if (hasKnowledge) { + // 有知识库 + 无网络搜索 + return t('input.placeholderWithContext'); + } else if (hasWebSearch) { + // 无知识库 + 有网络搜索 + return t('input.placeholderWebOnly'); + } else { + // 无知识库 + 无网络搜索(纯模型对话) + return t('input.placeholder'); + } +}); + // 加载知识库列表 const loadKnowledgeBases = async () => { try { @@ -1185,7 +1205,7 @@ onBeforeRouteUpdate((to, from, next) => { { const isFirstSession = ref(false) const firstQuery = ref('') + const firstMentionedItems = ref([]) const applyMenuTranslations = () => { menuArr.forEach(item => { @@ -90,14 +91,16 @@ export const useMenuStore = defineStore('menuStore', () => { isFirstSession.value = payload } - const changeFirstQuery = (payload: string) => { + const changeFirstQuery = (payload: string, mentionedItems: any[] = []) => { firstQuery.value = payload + firstMentionedItems.value = mentionedItems } return { menuArr, isFirstSession, firstQuery, + firstMentionedItems, clearMenuArr, updatemenuArr, updataMenuChildren, diff --git a/frontend/src/views/chat/components/botmsg.vue b/frontend/src/views/chat/components/botmsg.vue index 830f9f05..f40a6f8d 100644 --- a/frontend/src/views/chat/components/botmsg.vue +++ b/frontend/src/views/chat/components/botmsg.vue @@ -1,6 +1,23 @@