mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-29 14:43:56 +08:00
添加了新请求接口,大语言模型和意图参数关系的选择判断
--model.js 添加新接口方法 --roleConfig.vue 添加智能体配置,当选择的LLM不是openai、ollama类型时,意图模型不能选择“无意图识别“
This commit is contained in:
@@ -106,6 +106,22 @@ export default {
|
|||||||
});
|
});
|
||||||
}).send();
|
}).send();
|
||||||
},
|
},
|
||||||
|
// 获取LLM模型名称列表
|
||||||
|
getLlmModelCodeList(modelName, callback) {
|
||||||
|
RequestService.sendRequest()
|
||||||
|
.url(`${getServiceUrl()}/models/llm/names`)
|
||||||
|
.method('GET')
|
||||||
|
.data({ modelName })
|
||||||
|
.success((res) => {
|
||||||
|
RequestService.clearRequestTime();
|
||||||
|
callback(res);
|
||||||
|
})
|
||||||
|
.networkFail(() => {
|
||||||
|
RequestService.reAjaxFun(() => {
|
||||||
|
this.getLlmModelCodeList(modelName, callback);
|
||||||
|
});
|
||||||
|
}).send();
|
||||||
|
},
|
||||||
// 获取模型音色列表
|
// 获取模型音色列表
|
||||||
getModelVoices(modelId, voiceName, callback) {
|
getModelVoices(modelId, voiceName, callback) {
|
||||||
const queryParams = new URLSearchParams({
|
const queryParams = new URLSearchParams({
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
<div class="model-select-wrapper">
|
<div class="model-select-wrapper">
|
||||||
<el-select v-model="form.model[model.key]" filterable placeholder="请选择" class="form-select"
|
<el-select v-model="form.model[model.key]" filterable placeholder="请选择" class="form-select"
|
||||||
@change="handleModelChange(model.type, $event)">
|
@change="handleModelChange(model.type, $event)">
|
||||||
<el-option v-for="(item, optionIndex) in modelOptions[model.type]"
|
<el-option v-for="(item, optionIndex) in modelOptions[model.type]" v-if="!item.isHidden"
|
||||||
:key="`option-${index}-${optionIndex}`" :label="item.label" :value="item.value" />
|
:key="`option-${index}-${optionIndex}`" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<div v-if="showFunctionIcons(model.type)" class="function-icons">
|
<div v-if="showFunctionIcons(model.type)" class="function-icons">
|
||||||
@@ -130,7 +130,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<function-dialog v-model="showFunctionDialog" :functions="currentFunctions" :all-functions="allFunctions"
|
<function-dialog v-model="showFunctionDialog" :functions="currentFunctions" :all-functions="allFunctions"
|
||||||
:agent-id="$route.query.agentId" @update-functions="handleUpdateFunctions" @dialog-closed="handleDialogClosed" />
|
:agent-id="$route.query.agentId" @update-functions="handleUpdateFunctions" @dialog-closed="handleDialogClosed" />
|
||||||
</div>
|
</div>
|
||||||
@@ -173,8 +172,9 @@ export default {
|
|||||||
{ label: '视觉大模型(VLLM)', key: 'vllmModelId', type: 'VLLM' },
|
{ label: '视觉大模型(VLLM)', key: 'vllmModelId', type: 'VLLM' },
|
||||||
{ label: '意图识别(Intent)', key: 'intentModelId', type: 'Intent' },
|
{ label: '意图识别(Intent)', key: 'intentModelId', type: 'Intent' },
|
||||||
{ label: '记忆(Memory)', key: 'memModelId', type: 'Memory' },
|
{ label: '记忆(Memory)', key: 'memModelId', type: 'Memory' },
|
||||||
{ label: '语音合成(TTS)', key: 'ttsModelId', type: 'TTS' },
|
{ label: '语音合成(TTS)', key: 'ttsModelId', type: 'TTS' }
|
||||||
],
|
],
|
||||||
|
llmModeTypeMap: new Map(),
|
||||||
modelOptions: {},
|
modelOptions: {},
|
||||||
templates: [],
|
templates: [],
|
||||||
loadingTemplate: false,
|
loadingTemplate: false,
|
||||||
@@ -364,16 +364,36 @@ export default {
|
|||||||
},
|
},
|
||||||
fetchModelOptions() {
|
fetchModelOptions() {
|
||||||
this.models.forEach(model => {
|
this.models.forEach(model => {
|
||||||
Api.model.getModelNames(model.type, '', ({ data }) => {
|
if (model.type != "LLM") {
|
||||||
if (data.code === 0) {
|
Api.model.getModelNames(model.type, '', ({ data }) => {
|
||||||
this.$set(this.modelOptions, model.type, data.data.map(item => ({
|
if (data.code === 0) {
|
||||||
value: item.id,
|
this.$set(this.modelOptions, model.type, data.data.map(item => ({
|
||||||
label: item.modelName
|
value: item.id,
|
||||||
})));
|
label: item.modelName,
|
||||||
} else {
|
isHidden: false
|
||||||
this.$message.error(data.msg || '获取模型列表失败');
|
})));
|
||||||
}
|
} else {
|
||||||
});
|
this.$message.error(data.msg || '获取模型列表失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Api.model.getLlmModelCodeList('', ({ data }) => {
|
||||||
|
if (data.code === 0) {
|
||||||
|
let LLMdata = []
|
||||||
|
data.data.forEach(item => {
|
||||||
|
LLMdata.push({
|
||||||
|
value: item.id,
|
||||||
|
label: item.modelName,
|
||||||
|
isHidden: false
|
||||||
|
})
|
||||||
|
this.llmModeTypeMap.set(item.id, item.type)
|
||||||
|
})
|
||||||
|
this.$set(this.modelOptions, model.type, LLMdata);
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg || '获取LLM模型列表失败');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchVoiceOptions(modelId) {
|
fetchVoiceOptions(modelId) {
|
||||||
@@ -410,6 +430,24 @@ export default {
|
|||||||
if (type === 'Memory' && value !== 'Memory_nomem' && (this.form.chatHistoryConf === 0 || this.form.chatHistoryConf === null)) {
|
if (type === 'Memory' && value !== 'Memory_nomem' && (this.form.chatHistoryConf === 0 || this.form.chatHistoryConf === null)) {
|
||||||
this.form.chatHistoryConf = 2;
|
this.form.chatHistoryConf = 2;
|
||||||
}
|
}
|
||||||
|
if (type === 'LLM') {
|
||||||
|
let llmType = this.llmModeTypeMap.get(value)
|
||||||
|
let memory
|
||||||
|
for (let item of this.modelOptions['Intent']) {
|
||||||
|
if(item.value == "Intent_nointent" ) {
|
||||||
|
memory = item
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (llmType == "openai" || llmType == "ollama") {
|
||||||
|
memory.isHidden = false
|
||||||
|
}else{
|
||||||
|
memory.isHidden = true
|
||||||
|
}
|
||||||
|
if(this.form.model.intentModelId == "Intent_nointent"){
|
||||||
|
this.form.model.intentModelId = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fetchAllFunctions() {
|
fetchAllFunctions() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user