Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat(i18n): update WeKnoraCloud integration and enhance model management
wizardchenad27ed134e39
diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.tsindex cce54d11a..b4f5f2c89 100755--- a/frontend/src/i18n/locales/en-US.ts+++ b/frontend/src/i18n/locales/en-US.ts@@ -1178,7 +1178,7 @@ export default {saveHint: 'Credentials will be validated and encrypted before saving.',saveBtn: 'Save Credentials',usageTitle: 'Usage Guide',- usageSteps: '1. Fill in and save APPID and APPSECRET on this page\n2. Model services: Go to Model Management, add a model with Remote API source, select WeKnoraCloud as provider\n3. Document parsing: Go to Knowledge Base Settings → Parser Engine, select WeKnora Cloud engine for desired file types',+ usageSteps: '1. Save APPID and APPSECRET\n2. Register chat, embedding, rerank, and vlm in Cloud Models below\n3. Parser: Knowledge Base Settings → Parser Engine → WeKnora Cloud',fillRequired: 'Please fill in APPID and APPSECRET',saveSuccess: 'Credentials saved successfully',saveFailed: 'Failed to save credentials',@@ -1189,6 +1189,29 @@ export default {goToSettings: 'Go to Settings',modelHintConfigured: 'WeKnoraCloud credentials configured. See supported models in',modelHintDocsLink: 'API docs',+ modelsSection: {+ title: 'Cloud Models',+ descReady: 'Register the four standard WeKnora Cloud models for chat, retrieval, reranking, and vision.',+ descPending: 'Save credentials above before adding cloud models here.',+ statusAdded: 'Added',+ statusPending: 'Credentials required',+ addOne: 'Add',+ addAllBtn: 'Add all missing ({count})',+ addAllConfirm: 'Confirm',+ confirmAddOne: 'Add {type} model "{name}"?',+ confirmAddAll: 'Add all {count} missing cloud models at once?',+ allReady: 'All four cloud models are ready',+ },+ addModelsSuccess: 'Successfully added {count} model(s)',+ addModelsPartial: 'Added {success}, {failed} failed',+ addModelsFailed: 'Failed to add models',+ addModelsEmbeddingFailed: 'Embedding connection test failed; could not detect vector dimension',+ addModelsDisplayName: {+ chat: 'WeKnoraCloud Chat',+ embedding: 'WeKnoraCloud Embedding',+ rerank: 'WeKnoraCloud ReRank',+ vllm: 'WeKnoraCloud Vision',+ },},system: 'System Settings',systemConfig: 'System Configuration',@@ -4016,7 +4039,7 @@ export default {viewGuide: 'View Built-in Models Guide',},builtinTag: 'Built-in',- confirmDelete: 'Are you sure you want to delete this model?',+ confirmDelete: 'Delete model "{name}"?',},// New: Ollama SettingsollamaSettings: {diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.tsindex caf7529b7..97d76c031 100755--- a/frontend/src/i18n/locales/ko-KR.ts+++ b/frontend/src/i18n/locales/ko-KR.ts@@ -1035,7 +1035,7 @@ export default {saveHint: '저장 전 서비스 연결 가능 여부를 확인하고 암호화하여 저장합니다.',saveBtn: '자격 증명 저장',usageTitle: '사용 가이드',- usageSteps: '1. 이 페이지에서 APPID와 APPSECRET을 입력하고 저장\n2. 모델 서비스: 모델 관리에서 Remote API 소스로 모델 추가, 공급자로 WeKnoraCloud 선택\n3. 문서 파싱: 지식 베이스 설정 → 파싱 엔진에서 해당 파일 유형에 WeKnora Cloud 엔진 선택',+ usageSteps: '1. APPID / APPSECRET 저장\n2. 아래 「클라우드 모델」에서 chat, embedding, rerank, vlm 추가\n3. 문서 파싱: 지식 베이스 설정 → 파싱 엔진 → WeKnora Cloud',fillRequired: 'APPID와 APPSECRET을 입력하세요',saveSuccess: '자격 증명 저장 완료',saveFailed: '자격 증명 저장 실패',@@ -1046,6 +1046,29 @@ export default {goToSettings: '설정으로 이동',modelHintConfigured: 'WeKnoraCloud 자격 증명이 설정되었습니다. 지원 모델은',modelHintDocsLink: 'API 문서',+ modelsSection: {+ title: '클라우드 모델',+ descReady: 'WeKnora Cloud의 네 가지 표준 모델을 등록하여 대화, 검색, 재정렬, 비전에 사용합니다.',+ descPending: '위에서 자격 증명을 먼저 저장한 후 여기서 모델을 추가하세요.',+ statusAdded: '추가됨',+ statusPending: '자격 증명 필요',+ addOne: '추가',+ addAllBtn: '누락 모델 모두 추가 ({count})',+ addAllConfirm: '확인',+ confirmAddOne: '{type} 모델 "{name}"을(를) 추가하시겠습니까?',+ confirmAddAll: '누락된 클라우드 모델 {count}개를 한 번에 추가하시겠습니까?',+ allReady: '네 가지 클라우드 모델이 모두 준비되었습니다',+ },+ addModelsSuccess: '{count}개 모델이 추가되었습니다',+ addModelsPartial: '{success}개 추가, {failed}개 실패',+ addModelsFailed: '모델 추가 실패',+ addModelsEmbeddingFailed: 'Embedding 연결 테스트 실패, 벡터 차원을 가져올 수 없습니다',+ addModelsDisplayName: {+ chat: 'WeKnoraCloud 대화',+ embedding: 'WeKnoraCloud Embedding',+ rerank: 'WeKnoraCloud ReRank',+ vllm: 'WeKnoraCloud 비전',+ },},system: "시스템 설정",systemConfig: "시스템 구성",@@ -4035,7 +4058,7 @@ export default {viewGuide: "기본 제공 모델 관리 가이드 보기",},builtinTag: "기본제공",- confirmDelete: "이 모델을 삭제하시겠습니까?",+ confirmDelete: '모델 "{name}"을(를) 삭제하시겠습니까?',},// Ollama 설정ollamaSettings: {diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.tsindex 28380283e..a781cafaf 100755--- a/frontend/src/i18n/locales/ru-RU.ts+++ b/frontend/src/i18n/locales/ru-RU.ts@@ -1092,7 +1092,7 @@ export default {saveHint: 'Данные будут проверены и зашифрованы перед сохранением.',saveBtn: 'Сохранить',usageTitle: 'Инструкция',- usageSteps: '1. Заполните и сохраните APPID и APPSECRET\n2. Модели: перейдите в управление моделями, добавьте модель с источником Remote API, выберите WeKnoraCloud\n3. Парсинг документов: перейдите в настройки базы знаний → движок парсинга, выберите WeKnora Cloud для нужных типов файлов',+ usageSteps: '1. Сохраните APPID и APPSECRET\n2. Добавьте chat, embedding, rerank и vlm в разделе «Облачные модели» ниже\n3. Парсинг: Настройки БЗ → Движок парсинга → WeKnora Cloud',fillRequired: 'Заполните APPID и APPSECRET',saveSuccess: 'Учётные данные сохранены',saveFailed: 'Не удалось сохранить данные',@@ -1103,6 +1103,29 @@ export default {goToSettings: 'Перейти в настройки',modelHintConfigured: 'Учётные данные WeKnoraCloud настроены. Поддерживаемые модели см. в',modelHintDocsLink: 'документации API',+ modelsSection: {+ title: 'Облачные модели',+ descReady: 'Зарегистрируйте четыре стандартные модели WeKnora Cloud для чата, поиска, реранкинга и зрения.',+ descPending: 'Сначала сохраните учётные данные выше, затем добавьте модели здесь.',+ statusAdded: 'Добавлена',+ statusPending: 'Нужны учётные данные',+ addOne: 'Добавить',+ addAllBtn: 'Добавить все отсутствующие ({count})',+ addAllConfirm: 'Подтвердить',+ confirmAddOne: 'Добавить модель {type} «{name}»?',+ confirmAddAll: 'Добавить все {count} отсутствующих облачных моделей сразу?',+ allReady: 'Все четыре облачные модели готовы',+ },+ addModelsSuccess: 'Успешно добавлено моделей: {count}',+ addModelsPartial: 'Добавлено: {success}, ошибок: {failed}',+ addModelsFailed: 'Не удалось добавить модели',+ addModelsEmbeddingFailed: 'Тест подключения Embedding не пройден; не удалось определить размерность вектора',+ addModelsDisplayName: {+ chat: 'WeKnoraCloud Chat',+ embedding: 'WeKnoraCloud Embedding',+ rerank: 'WeKnoraCloud ReRank',+ vllm: 'WeKnoraCloud Vision',+ },},system: 'Настройки системы',systemConfig: 'Системная конфигурация',@@ -3695,7 +3718,7 @@ export default {viewGuide: 'Посмотреть руководство по управлению встроенными моделями'},builtinTag: 'Встроенная',- confirmDelete: 'Удалить эту модель?'+ confirmDelete: 'Удалить модель «{name}»?'},ollamaSettings: {title: 'Настройки Ollama',diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.tsindex f320f64fd..7dcf0660b 100755--- a/frontend/src/i18n/locales/zh-CN.ts+++ b/frontend/src/i18n/locales/zh-CN.ts@@ -1041,7 +1041,7 @@ export default {saveHint: "保存后将验证服务可达性并加密存储凭证",saveBtn: "保存凭证",usageTitle: "使用说明",- usageSteps: "1. 在此页面填写并保存 APPID 和 APPSECRET\n2. 模型服务:前往「模型管理」添加模型,选择 Remote API 来源,厂商选择「WeKnoraCloud」\n3. 文档解析:前往「知识库设置 → 解析引擎」,为对应文件类型选择「WeKnora Cloud」引擎",+ usageSteps: "1. 填写并保存 APPID / APPSECRET\n2. 在下方「云模型接入」中按行添加 chat、embedding、rerank、vlm\n3. 文档解析:知识库设置 → 解析引擎,选择 WeKnora Cloud 引擎",fillRequired: "请填写 APPID 和 APPSECRET",saveSuccess: "凭证保存成功",saveFailed: "凭证保存失败",@@ -1052,6 +1052,30 @@ export default {goToSettings: "前往设置中配置",modelHintConfigured: "WeKnoraCloud 凭证已配置。支持的模型可参考",modelHintDocsLink: "接口文档",+ modelsSection: {+ title: "云模型接入",+ descReady: "将 WeKnora Cloud 提供的四类标准模型注册到当前空间,用于对话、向量检索、重排序与多模态理解。",+ descPending: "请先保存上方凭证,再在此添加云模型。",+ statusAdded: "已添加",+ statusPending: "待配置凭证",+ addOne: "添加",+ addAllBtn: "添加全部缺失({count})",+ addAllConfirm: "确认添加",+ confirmAddOne: "添加 {type} 模型「{name}」?",+ confirmAddAll: "一次性添加 {count} 个缺失的云模型?",+ allReady: "四类云模型均已就绪",+ },+ addModelsSuccess: "已成功添加 {count} 个模型",+ addModelsPartial: "已添加 {success} 个,{failed} 个失败",+ addModelsFailed: "添加模型失败",+ addModelsAllExist: "四类模型均已存在",+ addModelsEmbeddingFailed: "Embedding 模型连接测试失败,无法获取向量维度",+ addModelsDisplayName: {+ chat: "WeKnoraCloud 对话",+ embedding: "WeKnoraCloud Embedding",+ rerank: "WeKnoraCloud ReRank",+ vllm: "WeKnoraCloud 视觉",+ },},system: "系统设置",systemConfig: "系统配置",@@ -4009,7 +4033,7 @@ export default {viewGuide: "查看内置模型管理指南",},builtinTag: "内置",- confirmDelete: "确定删除此模型吗?",+ confirmDelete: "确定删除模型「{name}」吗?",},// 新增:Ollama 设置ollamaSettings: {diff --git a/frontend/src/utils/weknoraCloudModels.ts b/frontend/src/utils/weknoraCloudModels.tsnew file mode 100644index 000000000..97fd2ae48--- /dev/null+++ b/frontend/src/utils/weknoraCloudModels.ts@@ -0,0 +1,72 @@+import type { ModelConfig } from '@/api/model'++export const WEKNORA_CLOUD_BASE_URL = 'https://weknora.weixin.qq.com'+export const WEKNORA_CLOUD_PROVIDER = 'weknoracloud'++export type WkcModelKind = 'chat' | 'embedding' | 'rerank' | 'vllm'++const BACKEND_TYPE_BY_KIND: Record<WkcModelKind, ModelConfig['type']> = {+ chat: 'KnowledgeQA',+ embedding: 'Embedding',+ rerank: 'Rerank',+ vllm: 'VLLM',+}++export const WKC_MODEL_NAME_BY_KIND: Record<WkcModelKind, string> = {+ chat: 'chat',+ embedding: 'embedding',+ rerank: 'rerank',+ vllm: 'vlm',+}++export const WKC_MODEL_KINDS: WkcModelKind[] = ['chat', 'embedding', 'rerank', 'vllm']++export function isWeKnoraCloudModel(model: ModelConfig): boolean {+ return model.parameters?.provider === WEKNORA_CLOUD_PROVIDER+}++/** Returns kinds that already have a WeKnoraCloud model of the matching backend type. */+export function existingWkcKinds(models: ModelConfig[]): Set<WkcModelKind> {+ const found = new Set<WkcModelKind>()+ for (const model of models) {+ if (!isWeKnoraCloudModel(model)) continue+ for (const kind of WKC_MODEL_KINDS) {+ if (model.type === BACKEND_TYPE_BY_KIND[kind]) {+ found.add(kind)+ }+ }+ }+ return found+}++export function buildWkcModelConfig(+ kind: WkcModelKind,+ displayName: string,+ dimension?: number,+): ModelConfig {+ const name = WKC_MODEL_NAME_BY_KIND[kind]+ const type = BACKEND_TYPE_BY_KIND[kind]+ const parameters: ModelConfig['parameters'] = {+ base_url: WEKNORA_CLOUD_BASE_URL,+ provider: WEKNORA_CLOUD_PROVIDER,+ }++ if (kind === 'embedding' && dimension) {+ parameters.embedding_parameters = {+ dimension,+ truncate_prompt_tokens: 0,+ }+ }+ if (kind === 'vllm') {+ parameters.supports_vision = true+ }++ return {+ name,+ display_name: displayName,+ type,+ source: 'remote',+ description: '',+ parameters,+ }+}diff --git a/frontend/src/views/settings/ModelSettings.vue b/frontend/src/views/settings/ModelSettings.vueindex f79b7775c..cbf1f6393 100644--- a/frontend/src/views/settings/ModelSettings.vue+++ b/frontend/src/views/settings/ModelSettings.vue@@ -58,14 +58,34 @@:aria-label="$t('modelSettings.builtinTag')"><t-icon name="lock-on" /></span>- <div v-if="getModelOptions(model._modelType, model).length > 0" class="model-card__actions" @click.stop>+ <div v-if="canManageModel(model)" class="model-card__actions" @click.stop><t-dropdown :options="getModelOptions(model._modelType, model)" placement="bottom-right" attach="body"trigger="click"@click="(data: any) => handleMenuAction({ value: data.value }, model._modelType, model)">- <t-button variant="text" shape="square" size="small" class="model-card__more">+ <t-button variant="text" shape="square" size="small" class="model-card__action-btn model-card__more"><t-icon name="ellipsis" /></t-button></t-dropdown>+ <t-popconfirm+ :content="$t('modelSettings.confirmDelete', { name: modelDisplayName(model) })"+ :confirm-btn="{ content: $t('common.delete'), theme: 'danger' }"+ :cancel-btn="{ content: $t('common.cancel') }"+ placement="bottom-right"+ @confirm="deleteModel(model._modelType, model.id)"+ >+ <t-tooltip :content="$t('common.delete')" placement="top">+ <t-button+ theme="danger"+ shape="square"+ variant="text"+ size="small"+ class="model-card__action-btn model-card__delete"+ @click.stop+ >+ <template #icon><t-icon name="delete" /></template>+ </t-button>+ </t-tooltip>+ </t-popconfirm></div></div><p class="model-card__subtitle">@@ -111,14 +131,11 @@ import { MessagePlugin } from 'tdesign-vue-next'import { AddIcon } from 'tdesign-icons-vue-next'import { useI18n } from 'vue-i18n'import ModelEditorDialog from '@/components/ModelEditorDialog.vue'-import { useConfirmDelete } from '@/components/settings/useConfirmDelete'import { listModels, createModel, updateModel as updateModelAPI, deleteModel as deleteModelAPI, type ModelConfig } from '@/api/model'import { useAuthStore } from '@/stores/auth'const { t, te } = useI18n()const authStore = useAuthStore()-const confirmDelete = useConfirmDelete()-type ModelType = 'chat' | 'embedding' | 'rerank' | 'vllm' | 'asr'type FilterType = 'all' | ModelType@@ -292,6 +309,9 @@ const openAddDialog = (type: ModelType) => {const isModelCardClickable = (model: any) =>authStore.hasRole('admin') && !model.isBuiltin+const canManageModel = (model: any) =>+ authStore.hasRole('admin') && !model.isBuiltin+const onModelCardClick = (event: Event, type: ModelType, model: any) => {if (!isModelCardClickable(model)) returnif (event.type === 'keydown') {@@ -479,12 +499,6 @@ const getModelOptions = (type: ModelType, model: any) => {value: `copy-${type}-${model.id}`})- options.push({- content: t('common.delete'),- value: `delete-${type}-${model.id}`,- theme: 'error'- })-return options}@@ -496,11 +510,6 @@ const handleMenuAction = (data: { value: string }, type: ModelType, model: any)editModel(type, model)} else if (value.indexOf('copy-') === 0) {copyModel(type, model.id)- } else if (value.indexOf('delete-') === 0) {- confirmDelete({- body: t('modelSettings.confirmDelete'),- onConfirm: () => deleteModel(type, model.id)- })}}@@ -834,14 +843,20 @@ onMounted(() => {.model-card__actions {flex-shrink: 0;+ display: flex;+ align-items: center;+ gap: 2px;}-.model-card__more {+.model-card__action-btn {flex-shrink: 0;- color: var(--td-text-color-placeholder);padding: 2px;opacity: 0;transition: opacity 0.15s ease;+}++.model-card__more {+ color: var(--td-text-color-placeholder);&:hover,&:focus-visible {@@ -850,10 +865,10 @@ onMounted(() => {}}-// Hover / 键盘焦点 时显示更多菜单,避免静态卡片上有"杂物"。-.model-card:hover .model-card__more,-.model-card:focus-within .model-card__more,-.model-card__actions:focus-within .model-card__more {+// Hover / 键盘焦点 时显示操作按钮,避免静态卡片上有"杂物"。+.model-card:hover .model-card__action-btn,+.model-card:focus-within .model-card__action-btn,+.model-card__actions:focus-within .model-card__action-btn {opacity: 1;}diff --git a/frontend/src/views/settings/WeKnoraCloudSettings.vue b/frontend/src/views/settings/WeKnoraCloudSettings.vueindex 7dba39a35..0ae1488cc 100644--- a/frontend/src/views/settings/WeKnoraCloudSettings.vue+++ b/frontend/src/views/settings/WeKnoraCloudSettings.vue@@ -97,6 +97,104 @@</div></div>+ <!-- 云模型:凭证就绪后原地展示接入状态 -->+ <section+ class="models-section"+ :class="{ 'models-section--disabled': credentialState !== 'configured' }"+ >+ <div class="models-section__header">+ <h3 class="models-section__title">{{ $t('settings.weknoraCloud.modelsSection.title') }}</h3>+ <p class="models-section__desc">+ {{+ credentialState === 'configured'+ ? $t('settings.weknoraCloud.modelsSection.descReady')+ : $t('settings.weknoraCloud.modelsSection.descPending')+ }}+ </p>+ </div>++ <div class="models-list">+ <div+ v-for="kind in WKC_MODEL_KINDS"+ :key="kind"+ class="model-row"+ >+ <div class="model-row__main">+ <span class="model-row__label">{{ kindLabel(kind) }}</span>+ <code class="model-row__id">{{ WKC_MODEL_NAME_BY_KIND[kind] }}</code>+ </div>+ <div class="model-row__action">+ <t-tag+ v-if="credentialState === 'configured' && existingKinds.has(kind)"+ theme="success"+ variant="light"+ size="small"+ >+ {{ $t('settings.weknoraCloud.modelsSection.statusAdded') }}+ </t-tag>+ <t-popconfirm+ v-else-if="credentialState === 'configured'"+ :content="$t('settings.weknoraCloud.modelsSection.confirmAddOne', {+ type: kindLabel(kind),+ name: WKC_MODEL_NAME_BY_KIND[kind],+ })"+ :confirm-btn="{ content: $t('settings.weknoraCloud.modelsSection.addOne'), theme: 'primary' }"+ :cancel-btn="{ content: $t('common.cancel') }"+ placement="left"+ @confirm="addModels([kind])"+ >+ <t-button+ size="small"+ variant="outline"+ theme="primary"+ :loading="addingKind === kind"+ :disabled="addingModels && addingKind !== kind"+ @click.stop+ >+ {{ $t('settings.weknoraCloud.modelsSection.addOne') }}+ </t-button>+ </t-popconfirm>+ <span v-else class="model-row__pending">+ {{ $t('settings.weknoraCloud.modelsSection.statusPending') }}+ </span>+ </div>+ </div>+ </div>++ <div+ v-if="credentialState === 'configured' && missingKinds.length > 1"+ class="models-section__batch"+ >+ <t-popconfirm+ :content="$t('settings.weknoraCloud.modelsSection.confirmAddAll', { count: missingKinds.length })"+ :confirm-btn="{+ content: $t('settings.weknoraCloud.modelsSection.addAllConfirm'),+ theme: 'primary',+ }"+ :cancel-btn="{ content: $t('common.cancel') }"+ placement="top"+ @confirm="addModels([...missingKinds])"+ >+ <t-button+ theme="primary"+ size="small"+ :loading="addingModels && !addingKind"+ :disabled="addingModels && !!addingKind"+ >+ {{ $t('settings.weknoraCloud.modelsSection.addAllBtn', { count: missingKinds.length }) }}+ </t-button>+ </t-popconfirm>+ </div>++ <p+ v-else-if="credentialState === 'configured' && missingKinds.length === 0"+ class="models-section__ready"+ >+ <t-icon name="check-circle-filled" class="models-section__ready-icon" />+ {{ $t('settings.weknoraCloud.modelsSection.allReady') }}+ </p>+ </section>+<!-- 使用说明 --><div class="usage-hint"><p class="hint-title">{{ $t('settings.weknoraCloud.usageTitle') }}</p>@@ -109,7 +207,17 @@import { ref, computed, onMounted } from 'vue'import { MessagePlugin } from 'tdesign-vue-next'import { useI18n } from 'vue-i18n'-import { saveWeKnoraCloudCredentials, getWeKnoraCloudStatus } from '@/api/model'+import { saveWeKnoraCloudCredentials, getWeKnoraCloudStatus, createModel, listModels } from '@/api/model'+import { testEmbeddingModel } from '@/api/initialization'+import {+ WKC_MODEL_KINDS,+ WKC_MODEL_NAME_BY_KIND,+ WEKNORA_CLOUD_BASE_URL,+ WEKNORA_CLOUD_PROVIDER,+ buildWkcModelConfig,+ existingWkcKinds,+ type WkcModelKind,+} from '@/utils/weknoraCloudModels'const { t } = useI18n()@@ -119,6 +227,9 @@ const needsReinit = ref(false)const reinitReason = ref('')const hasCredentials = ref(false)const formExpanded = ref(true)+const existingKinds = ref<Set<WkcModelKind>>(new Set())+const addingModels = ref(false)+const addingKind = ref<WkcModelKind | null>(null)const credentialState = computed(() => {if (needsReinit.value) return 'expired'@@ -126,6 +237,86 @@ const credentialState = computed(() => {return 'unconfigured'})+const missingKinds = computed(() =>+ WKC_MODEL_KINDS.filter((kind) => !existingKinds.value.has(kind)),+)++const kindLabel = (kind: WkcModelKind) => {+ const key = `modelSettings.typeShort.${kind === 'vllm' ? 'vllm' : kind}` as const+ return t(key)+}++const kindDisplayName = (kind: WkcModelKind) =>+ t(`settings.weknoraCloud.addModelsDisplayName.${kind}`)++const refreshExistingKinds = async () => {+ try {+ const models = await listModels()+ existingKinds.value = existingWkcKinds(models)+ } catch {+ existingKinds.value = new Set()+ }+}++const resolveEmbeddingDimension = async (): Promise<number> => {+ const result = await testEmbeddingModel({+ source: 'remote',+ modelName: WKC_MODEL_NAME_BY_KIND.embedding,+ baseUrl: WEKNORA_CLOUD_BASE_URL,+ provider: WEKNORA_CLOUD_PROVIDER,+ })+ if (!result.available || !result.dimension) {+ throw new Error(result.message || t('settings.weknoraCloud.addModelsEmbeddingFailed'))+ }+ return result.dimension+}++const addModels = async (kinds: WkcModelKind[]) => {+ const targets = kinds.filter((kind) => !existingKinds.value.has(kind))+ if (targets.length === 0) {+ return+ }++ addingModels.value = true+ addingKind.value = targets.length === 1 ? targets[0] : null++ let success = 0+ let failed = 0+ let embeddingDimension: number | undefined++ try {+ for (const kind of targets) {+ try {+ if (kind === 'embedding') {+ embeddingDimension = embeddingDimension ?? await resolveEmbeddingDimension()+ }+ const payload = buildWkcModelConfig(+ kind,+ kindDisplayName(kind),+ kind === 'embedding' ? embeddingDimension : undefined,+ )+ await createModel(payload)+ existingKinds.value = new Set([...existingKinds.value, kind])+ success += 1+ } catch (err: any) {+ console.error(`Failed to create WeKnoraCloud ${kind} model:`, err)+ failed += 1+ }+ }++ if (success > 0 && failed === 0) {+ MessagePlugin.success(t('settings.weknoraCloud.addModelsSuccess', { count: success }))+ } else if (success > 0) {+ MessagePlugin.warning(t('settings.weknoraCloud.addModelsPartial', { success, failed }))+ } else {+ MessagePlugin.error(t('settings.weknoraCloud.addModelsFailed'))+ }+ } finally {+ addingModels.value = false+ addingKind.value = null+ }+}+const handleSave = async () => {if (!form.value.appId || !form.value.appSecret) {MessagePlugin.warning(t('settings.weknoraCloud.fillRequired'))@@ -144,6 +335,7 @@ const handleSave = async () => {reinitReason.value = ''hasCredentials.value = trueformExpanded.value = false+ await refreshExistingKinds()} catch (err: any) {MessagePlugin.error(err?.message || t('settings.weknoraCloud.saveFailed'))} finally {@@ -159,14 +351,15 @@ const checkStatus = async () => {hasCredentials.value = status.has_models && !status.needs_reinitif (hasCredentials.value) {formExpanded.value = false+ await refreshExistingKinds()}} catch {// silent}}-onMounted(() => {- checkStatus()+onMounted(async () => {+ await checkStatus()})</script>@@ -286,6 +479,112 @@ onMounted(() => {flex-shrink: 0;}+.models-section {+ margin-bottom: 24px;+ padding: 16px;+ border: 1px solid var(--td-component-stroke);+ border-radius: 8px;+ background: var(--td-bg-color-container);++ &--disabled {+ opacity: 0.92;+ background: var(--td-bg-color-secondarycontainer);+ }++ &__header {+ margin-bottom: 14px;+ }++ &__title {+ margin: 0 0 6px;+ font-size: 15px;+ font-weight: 600;+ color: var(--td-text-color-primary);+ }++ &__desc {+ margin: 0;+ font-size: 13px;+ line-height: 1.55;+ color: var(--td-text-color-secondary);+ }++ &__batch {+ margin-top: 14px;+ padding-top: 14px;+ border-top: 1px dashed var(--td-component-stroke);+ }++ &__ready {+ display: flex;+ align-items: center;+ gap: 6px;+ margin: 14px 0 0;+ font-size: 13px;+ color: var(--td-success-color, #2ba471);+ }++ &__ready-icon {+ font-size: 15px;+ flex-shrink: 0;+ }+}++.models-list {+ display: flex;+ flex-direction: column;+ gap: 0;+}++.model-row {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 12px;+ padding: 12px 0;+ border-bottom: 1px solid var(--td-component-stroke);++ &:last-child {+ border-bottom: none;+ padding-bottom: 0;+ }++ &:first-child {+ padding-top: 4px;+ }++ &__main {+ display: flex;+ align-items: center;+ gap: 10px;+ min-width: 0;+ }++ &__label {+ font-size: 14px;+ font-weight: 500;+ color: var(--td-text-color-primary);+ min-width: 88px;+ }++ &__id {+ font-size: 12px;+ color: var(--td-text-color-secondary);+ background: var(--td-bg-color-secondarycontainer);+ padding: 2px 6px;+ border-radius: 4px;+ }++ &__action {+ flex-shrink: 0;+ }++ &__pending {+ font-size: 12px;+ color: var(--td-text-color-placeholder);+ }+}+.usage-hint {padding: 14px 16px;background: var(--td-bg-color-secondarycontainer);