|
|
@@ -321,6 +321,34 @@
|
|
|
<el-switch v-model="modelForm.supports_vision" />
|
|
|
</el-form-item>
|
|
|
|
|
|
+ <el-form-item
|
|
|
+ v-if="modelForm.source === 'remote' && modelForm.type === 'KnowledgeQA'"
|
|
|
+ label="思考模式参数格式"
|
|
|
+ prop="thinking_control"
|
|
|
+ >
|
|
|
+ <el-select
|
|
|
+ v-model="modelForm.thinking_control"
|
|
|
+ placeholder="请选择思考模式参数格式"
|
|
|
+ popper-class="thinking-control-select"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="option in thinkingControlOptions"
|
|
|
+ :key="option.value"
|
|
|
+ :label="option.title"
|
|
|
+ :value="option.value"
|
|
|
+ >
|
|
|
+ <div class="thinking-option">
|
|
|
+ <div class="thinking-option__title">{{ option.title }}</div>
|
|
|
+ <div class="thinking-option__desc">{{ option.description }}</div>
|
|
|
+ </div>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <div class="field-tip">
|
|
|
+ 决定智能体「思考模式」开/关时如何写入 API。已尝试按厂商/模型预选,若与实际情况不符请按 API 文档手动修改;选「不写入」时,智能体「思考模式」开关不生效。
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
<el-form-item prop="custom_headers">
|
|
|
<div class="header-config">
|
|
|
<div class="header-config__top">
|
|
|
@@ -391,7 +419,8 @@ import type {
|
|
|
ModelCreateForm,
|
|
|
ModelDetail,
|
|
|
OllamaModel,
|
|
|
- modelType
|
|
|
+ modelType,
|
|
|
+ ThinkingControlType
|
|
|
} from './types'
|
|
|
|
|
|
const props = withDefaults(
|
|
|
@@ -414,6 +443,32 @@ const currentDetailModel = ref<ModelDetail | null>(null)
|
|
|
const modelFormRef = ref()
|
|
|
const customHeaderList = ref<Array<{ key: string; value: string }>>([{ key: '', value: '' }])
|
|
|
const localModelOptions = ref<OllamaModel[]>([])
|
|
|
+const thinkingControlOptions: Array<{
|
|
|
+ title: string
|
|
|
+ description: string
|
|
|
+ value: ThinkingControlType
|
|
|
+}> = [
|
|
|
+ {
|
|
|
+ title: '不写入思考参数',
|
|
|
+ description: '智能体「思考模式」开关不生效,不会在请求中写入思考相关参数',
|
|
|
+ value: 'none'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'chat_template_kwargs',
|
|
|
+ description: '自定义 OpenAI 兼容、NVIDIA NIM、vLLM / 本地 Qwen 部署',
|
|
|
+ value: 'chat_template_kwargs'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'enable_thinking',
|
|
|
+ description: '阿里云 DashScope:qwen3、qwen-plus、qwen-max、qwen-turbo',
|
|
|
+ value: 'enable_thinking'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'thinking.type',
|
|
|
+ description: '火山引擎 Ark;腾讯云 LKEAP(DeepSeek V3 等,选 LKEAP 时默认此项;R1 请改「不写入」)',
|
|
|
+ value: 'thinking_type'
|
|
|
+ }
|
|
|
+]
|
|
|
const detailCheckLoading = ref(false)
|
|
|
const detailCheckResult = reactive<{ success: boolean; message: string }>({
|
|
|
success: false,
|
|
|
@@ -451,7 +506,8 @@ const modelForm = reactive<ModelCreateForm>({
|
|
|
custom_headers: {},
|
|
|
dimension: undefined,
|
|
|
truncate_prompt_tokens: undefined,
|
|
|
- supports_vision: false
|
|
|
+ supports_vision: false,
|
|
|
+ thinking_control: 'none'
|
|
|
})
|
|
|
|
|
|
const modelRules = {
|
|
|
@@ -672,6 +728,11 @@ async function openEditModel(id: string) {
|
|
|
key,
|
|
|
value: String(value ?? '')
|
|
|
}))
|
|
|
+ const extraConfig = ((data as any)?.parameters?.extra_config ||
|
|
|
+ (data as any)?.extra_config ||
|
|
|
+ {}) as {
|
|
|
+ thinking_control?: ThinkingControlType
|
|
|
+ }
|
|
|
customHeaderList.value = headerRows.length ? headerRows : [{ key: '', value: '' }]
|
|
|
Object.assign(modelForm, {
|
|
|
source: data.source,
|
|
|
@@ -686,6 +747,7 @@ async function openEditModel(id: string) {
|
|
|
dimension: data.parameters?.embedding_parameters?.dimension,
|
|
|
truncate_prompt_tokens: data.parameters?.embedding_parameters?.truncate_prompt_tokens,
|
|
|
supports_vision: Boolean((data as any)?.parameters?.supports_vision),
|
|
|
+ thinking_control: extraConfig.thinking_control || 'none',
|
|
|
is_default: data.is_default
|
|
|
})
|
|
|
}
|
|
|
@@ -709,6 +771,7 @@ function resetModelForm() {
|
|
|
dimension: undefined,
|
|
|
truncate_prompt_tokens: undefined,
|
|
|
supports_vision: false,
|
|
|
+ thinking_control: 'none',
|
|
|
is_default: false
|
|
|
})
|
|
|
}
|
|
|
@@ -727,6 +790,7 @@ function handleSourceChange() {
|
|
|
modelForm.name = ''
|
|
|
modelForm.provider = ''
|
|
|
modelForm.base_url = ''
|
|
|
+ modelForm.thinking_control = 'none'
|
|
|
resetFormCheckResult()
|
|
|
}
|
|
|
|
|
|
@@ -740,9 +804,11 @@ async function handleTypeChange() {
|
|
|
}
|
|
|
if (modelForm.type === 'KnowledgeQA') {
|
|
|
modelForm.supports_vision = modelForm.supports_vision ?? false
|
|
|
+ modelForm.thinking_control = getDefaultThinkingControl(modelForm.provider)
|
|
|
return
|
|
|
}
|
|
|
modelForm.supports_vision = false
|
|
|
+ modelForm.thinking_control = 'none'
|
|
|
modelForm.dimension = undefined
|
|
|
modelForm.truncate_prompt_tokens = undefined
|
|
|
// getProviders(modelForm.type)
|
|
|
@@ -751,9 +817,29 @@ async function handleTypeChange() {
|
|
|
function handleProviderChange() {
|
|
|
const provider = providers.value.find((p) => p.value === modelForm.provider)
|
|
|
if (provider) modelForm.base_url = getDefaultUrlByType(provider) || ''
|
|
|
+ modelForm.thinking_control = getDefaultThinkingControl(modelForm.provider)
|
|
|
resetFormCheckResult()
|
|
|
}
|
|
|
|
|
|
+function getDefaultThinkingControl(provider?: string): ThinkingControlType {
|
|
|
+ const providerValue = (provider || '').toLowerCase()
|
|
|
+ if (providerValue.includes('dashscope') || providerValue.includes('aliyun')) {
|
|
|
+ return 'enable_thinking'
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ providerValue.includes('volc') ||
|
|
|
+ providerValue.includes('ark') ||
|
|
|
+ providerValue.includes('lkeap') ||
|
|
|
+ providerValue.includes('tencent')
|
|
|
+ ) {
|
|
|
+ return 'thinking_type'
|
|
|
+ }
|
|
|
+ if (providerValue.includes('nvidia') || providerValue.includes('nim') || providerValue.includes('vllm')) {
|
|
|
+ return 'chat_template_kwargs'
|
|
|
+ }
|
|
|
+ return 'none'
|
|
|
+}
|
|
|
+
|
|
|
function getDefaultUrlByType(provider: ModelProvider) {
|
|
|
const typeToDefaultUrlKey: Record<string, keyof ModelProvider['defaultUrls']> = {
|
|
|
KnowledgeQA: 'chat',
|
|
|
@@ -882,13 +968,19 @@ async function submitModelForm() {
|
|
|
: false,
|
|
|
dimension: modelForm.type === 'Embedding' ? modelForm.dimension : undefined,
|
|
|
truncate_prompt_tokens:
|
|
|
- modelForm.type === 'Embedding' ? modelForm.truncate_prompt_tokens : undefined
|
|
|
+ modelForm.type === 'Embedding' ? modelForm.truncate_prompt_tokens : undefined,
|
|
|
+ extra_config: {
|
|
|
+ thinking_control:
|
|
|
+ modelForm.source === 'remote' && modelForm.type === 'KnowledgeQA'
|
|
|
+ ? modelForm.thinking_control
|
|
|
+ : 'none'
|
|
|
+ }
|
|
|
}
|
|
|
if (currentModelId.value) {
|
|
|
- await aiModel.postModelUpdate({ id: currentModelId.value, ...params })
|
|
|
+ await aiModel.postModelUpdate({ id: currentModelId.value, ...params } as any)
|
|
|
ElMessage.success('更新成功')
|
|
|
} else {
|
|
|
- await aiModel.postModelCreate(params)
|
|
|
+ await aiModel.postModelCreate(params as any)
|
|
|
ElMessage.success('创建成功')
|
|
|
}
|
|
|
showModelDialog.value = false
|
|
|
@@ -960,6 +1052,42 @@ onMounted(() => {
|
|
|
width: 100%;
|
|
|
}
|
|
|
|
|
|
+.field-tip {
|
|
|
+ margin-top: 8px;
|
|
|
+ color: var(--text-tertiary);
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 1.6;
|
|
|
+}
|
|
|
+
|
|
|
+.thinking-option {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ min-height: 54px;
|
|
|
+ padding: 6px 0;
|
|
|
+ line-height: 1.35;
|
|
|
+}
|
|
|
+
|
|
|
+.thinking-option__title {
|
|
|
+ color: var(--text-primary);
|
|
|
+ font-size: 13px;
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
+
|
|
|
+.thinking-option__desc {
|
|
|
+ margin-top: 3px;
|
|
|
+ color: var(--text-tertiary);
|
|
|
+ font-size: 12px;
|
|
|
+ white-space: normal;
|
|
|
+}
|
|
|
+
|
|
|
+:global(.thinking-control-select .el-select-dropdown__item) {
|
|
|
+ height: auto;
|
|
|
+ min-height: 62px;
|
|
|
+ padding-top: 4px;
|
|
|
+ padding-bottom: 4px;
|
|
|
+}
|
|
|
+
|
|
|
.action-bar {
|
|
|
display: flex;
|
|
|
align-items: center;
|