feat: 优化输入框placeholder动态显示逻辑,支持基于知识库和网络搜索状态的个性化提示
This commit is contained in:
@@ -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) => {
|
||||
<t-textarea
|
||||
ref="textareaRef"
|
||||
v-model="query"
|
||||
:placeholder="allSelectedItems.length > 0 ? $t('input.placeholderWithContext') : $t('input.placeholder')"
|
||||
:placeholder="inputPlaceholder"
|
||||
name="description"
|
||||
:autosize="true"
|
||||
@keydown="onKeydown"
|
||||
|
||||
Reference in New Issue
Block a user