1.5.9前端

AI智能表单填充:AI模型修改为从前端动态传参
AI相关功能增加权限配置
master
xs 2 months ago
parent 2848f31ce3
commit 6a47a90801

@ -26,7 +26,7 @@ export const asr = (data: any) => {
export const uploadFile = (data: any) => {
return request({
url: '/resource/oss/upload',
url: '/ai/asr/upload',
method: 'post',
data: data
});
@ -39,5 +39,3 @@ export const recognizeSpeechByUrl = (audioUrl: string) => {
params: {audioUrl}
});
};

@ -37,10 +37,11 @@
placeholder="选择AI模型"
size="small"
popper-class="topIndex"
style="width: 120px"
style="width: 150px"
:teleported="true"
append-to="body"
:disabled="aiThinking"
@change="onModelChange"
>
<el-option
v-for="model in aiModelList"
@ -163,7 +164,7 @@
@click="toggleRecording"
:class="['recording-btn', { 'recording': isRecording }]"
v-loading="audioAsrLoading"
:disabled="!canSend || aiThinking"
:disabled="aiThinking"
circle
type="primary"
>
@ -214,6 +215,8 @@ import {AiFormSettingVO, AiFormSettingDetailVO} from '@/api/ai/base/aiFormSettin
import {aiFillForm, recognizeSpeechByUrl, uploadFile} from '@/api/ai/skill/aiAssistant';
import router from "@/router"
import {useSharedDataStore} from '@/api/monitorData'
import {getAiModelJoinList} from "@/api/ai/skill/aiChat";
import {AIModelVO} from "@/api/ai/skill/aiChat/types";
const sharedStore = useSharedDataStore()
@ -406,9 +409,41 @@ defineExpose({
});
const getAiModelList = async () => {
// loading.value = true;
const res = await getAiModelJoinList({modelTypeId: 1});
aiModelList.value = res.data;
await setDefaultAiModel();
// console.log(res)
// platformList.value = res.data;
// loading.value = false;
}
const setDefaultAiModel = async () => {
aiModelList.value.forEach((item: AIModelVO) => {
if (item.defaultFlag === "1") {
// alert(JSON.stringify(item))
selectedModelId.value = item.modelId;
selectedPlatformId.value = item.platformId;
// provider.value = item.platformCode;
// console.log(item.platformIcon)
// platformIcon.value = item.platformIcon;
}
})
}
function onModelChange() {
const model = aiModelList.value.find(m => m.modelId === selectedModelId.value)
if (model) {
selectedPlatformId.value = model.platformId
// platformIcon.value = model.platformIcon;
}
}
watch(state, (newVal) => {
if (newVal.isShowSearch) {
loadForms()
getAiModelList();
}
});
@ -471,7 +506,7 @@ const handleSend = async (selectedText?: string) => {
formSettingId: selectedFormSettingId.value,
formSettingDetailList: aiFormSettingDetailListMap.value[selectedFormSettingId.value],
modelId: selectedModelId.value,
platformId: 1
platformId: selectedPlatformId.value
}
// chatList.value.push({
@ -978,7 +1013,8 @@ const aiModelList = ref([
{ modelId: 3, modelName: 'Claude-3' },
{ modelId: 4, modelName: 'Gemini-Pro' }
])
const selectedModelId = ref(1) //
const selectedModelId = ref() // AIID
const selectedPlatformId = ref() // AIID
//
const moreFilterText = ref('')

@ -35,7 +35,7 @@
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
<el-button type="success" icon="Plus" @click="handleAdd"></el-button>
<el-button type="success" icon="Plus" v-hasPermi="['ai:aiFormSetting:add']" @click="handleAdd"></el-button>
</el-form-item>
</el-form>
</el-card>

@ -62,8 +62,8 @@
<div class="card-row"><span class="label">基础模型</span>{{ item.baseModelName }}</div>
</div>
<div class="card-actions-bottom">
<el-button size="small" @click="onEdit(item)"></el-button>
<el-button size="small" type="danger" @click="handleDelete(item)"></el-button>
<el-button size="small" type="primary" @click="onEdit(item)" v-hasPermi="['ai:aiModel:edit']"></el-button>
<el-button size="small" type="danger" @click="handleDelete(item)" v-hasPermi="['ai:aiModel:remove']"></el-button>
</div>
</el-card>
</div>

@ -77,8 +77,8 @@
<span>向量模型{{ kb.modelName }}</span>
</div>
<div class="kb-card-actions">
<el-button size="small" type="primary" @click.stop="handleUpdate(kb)">编辑</el-button>
<el-button size="small" type="danger" @click.stop="handleDelete(kb)">删除</el-button>
<el-button size="small" type="primary" @click.stop="handleUpdate(kb)" v-hasPermi="['ai:aiKnowledgeBase:edit']"></el-button>
<el-button size="small" type="danger" @click.stop="handleDelete(kb)" v-hasPermi="['ai:aiKnowledgeBase:remove']"></el-button>
<!-- <el-button size="small" type="primary" @click.stop="openArrangeDialog(kb)">编排</el-button>-->
<el-button size="small" type="success" @click.stop="goQA(kb)" v-if="kb.knowledgeBaseStatus === '1'"></el-button>
</div>
@ -91,6 +91,7 @@
:active-value="'1'"
:inactive-value="'0'"
@change="(val: string) => handleStatusChange(kb, val)"
v-hasPermi="['ai:aiKnowledgeBase:edit']"
@click.stop
style="margin-left: 8px;"
/>
@ -604,7 +605,7 @@ function onCreateDialogClose() {
.kb-card-status-switch span {
color: #fff;
background: #67c23a;
background: #a0c23a;
border-radius: 4px;
padding: 2px 10px;
display: inline-block;

Loading…
Cancel
Save