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 @@