mirror of
https://github.com/hellodigua/ChatLab.git
synced 2026-10-26 02:04:37 +08:00
feat: AI 模型配置支持自定义名称
This commit is contained in:
1 parent
647f61fbae
commit
ea91420e94
7 files changed
+37
-3
No files matched your search
@@ -8,7 +8,7 @@ Reach out via community channels or email to get updates and share feedback.
|
||||
|
||||
## Twitter (X)
|
||||
|
||||
[https://x.com/chatlabfun](https://x.com/chatlabfun)
|
||||
[https://x.com/openchatlab](https://x.com/openchatlab)
|
||||
|
||||
## Contact Developer
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"customModelIdHint": "The model identifier used in API calls",
|
||||
"customModelDisplayName": "Display Name",
|
||||
"customModelDisplayNamePlaceholder": "Custom display name",
|
||||
"modelRequired": "Add at least one model to save",
|
||||
"modelCapabilities": "Model Capabilities"
|
||||
},
|
||||
"providerKind": {
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"customModelIdHint": "API呼び出しで使用されるモデル識別子",
|
||||
"customModelDisplayName": "表示名",
|
||||
"customModelDisplayNamePlaceholder": "カスタム表示名",
|
||||
"modelRequired": "少なくとも 1 つのモデルを追加してから保存してください",
|
||||
"modelCapabilities": "モデル能力ラベル"
|
||||
},
|
||||
"providerKind": {
|
||||
|
||||
@@ -126,7 +126,8 @@
|
||||
"customModelIdHint": "API 调用时使用的模型标识符",
|
||||
"customModelDisplayName": "显示名称",
|
||||
"customModelDisplayNamePlaceholder": "自定义显示名",
|
||||
"modelCapabilities": "模型能力标注"
|
||||
"modelCapabilities": "模型能力标注",
|
||||
"modelRequired": "至少添加一个模型才能保存"
|
||||
},
|
||||
"providerKind": {
|
||||
"official": "官方",
|
||||
|
||||
@@ -126,6 +126,7 @@
|
||||
"customModelIdHint": "API 呼叫時使用的模型識別碼",
|
||||
"customModelDisplayName": "顯示名稱",
|
||||
"customModelDisplayNamePlaceholder": "自訂顯示名稱",
|
||||
"modelRequired": "至少新增一個模型才能儲存",
|
||||
"modelCapabilities": "模型能力標註"
|
||||
},
|
||||
"providerKind": {
|
||||
|
||||
@@ -233,6 +233,10 @@ function closeModal() {
|
||||
</label>
|
||||
|
||||
<UITabs v-if="modelTabItems.length > 0" v-model="formData.model" :items="modelTabItems" size="xs" />
|
||||
<p v-else class="flex items-center gap-1 text-xs text-amber-500 dark:text-amber-400">
|
||||
<UIcon name="i-heroicons-exclamation-triangle" class="h-3.5 w-3.5 shrink-0" />
|
||||
{{ t('settings.aiConfig.modal.modelRequired') }}
|
||||
</p>
|
||||
<p v-if="formData.model" class="mt-2 text-xs text-gray-500 dark:text-gray-400">
|
||||
{{ t('settings.aiConfig.modal.customModelId') }}: {{ formData.model }}
|
||||
</p>
|
||||
@@ -310,6 +314,10 @@ function closeModal() {
|
||||
</label>
|
||||
|
||||
<UITabs v-if="modelTabItems.length > 0" v-model="formData.model" :items="modelTabItems" size="xs" />
|
||||
<p v-else class="flex items-center gap-1 text-xs text-amber-500 dark:text-amber-400">
|
||||
<UIcon name="i-heroicons-exclamation-triangle" class="h-3.5 w-3.5 shrink-0" />
|
||||
{{ t('settings.aiConfig.modal.modelRequired') }}
|
||||
</p>
|
||||
<p v-if="formData.model" class="mt-2 text-xs text-gray-500 dark:text-gray-400">
|
||||
{{ t('settings.aiConfig.modal.customModelId') }}: {{ formData.model }}
|
||||
</p>
|
||||
@@ -333,6 +341,25 @@ function closeModal() {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- ===== 通用:自定义配置名称 ===== -->
|
||||
<template v-if="formData.provider || !isPresetMode">
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{{ t('settings.aiConfig.modal.configName') }}
|
||||
<span class="font-normal text-gray-400">{{ t('settings.aiConfig.modal.optional') }}</span>
|
||||
</label>
|
||||
<UInput
|
||||
v-model="formData.customName"
|
||||
class="w-full"
|
||||
:placeholder="
|
||||
isPresetMode
|
||||
? t('settings.aiConfig.modal.configNamePlaceholderPreset')
|
||||
: t('settings.aiConfig.modal.configNamePlaceholderCustom')
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- ===== 通用:推理模型选项 ===== -->
|
||||
<template v-if="formData.provider || !isPresetMode">
|
||||
<div class="flex items-center justify-between rounded-lg bg-gray-50 p-3 dark:bg-gray-800">
|
||||
|
||||
@@ -84,6 +84,7 @@ export function useAIConfigForm(props: {
|
||||
apiKey: '',
|
||||
model: '',
|
||||
baseUrl: '',
|
||||
customName: '',
|
||||
disableThinking: true,
|
||||
isReasoningModel: false,
|
||||
})
|
||||
@@ -174,6 +175,7 @@ export function useAIConfigForm(props: {
|
||||
apiKey: '',
|
||||
model: defaultChat?.id || defaultModels[0]?.id || '',
|
||||
baseUrl: defaultProviderDef?.defaultBaseUrl || '',
|
||||
customName: '',
|
||||
disableThinking: true,
|
||||
isReasoningModel: false,
|
||||
}
|
||||
@@ -204,6 +206,7 @@ export function useAIConfigForm(props: {
|
||||
apiKey: config.apiKey || '',
|
||||
model: isCompat ? config.model || '' : hasModelInCatalog ? config.model || '' : '',
|
||||
baseUrl: config.baseUrl || providerDef?.defaultBaseUrl || '',
|
||||
customName: config.name || '',
|
||||
disableThinking: config.disableThinking ?? true,
|
||||
isReasoningModel: config.isReasoningModel ?? false,
|
||||
}
|
||||
@@ -389,7 +392,7 @@ export function useAIConfigForm(props: {
|
||||
if (!finalApiKey && isLocalMode.value) {
|
||||
finalApiKey = 'sk-no-key-required'
|
||||
}
|
||||
const finalName = generateName()
|
||||
const finalName = formData.value.customName.trim() || generateName()
|
||||
|
||||
const isReasoning = formData.value.isReasoningModel
|
||||
const persistCustomModels =
|
||||
|
||||
Reference in new issue
Block a user