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

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

@ -35,7 +35,7 @@
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button> <el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></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-item>
</el-form> </el-form>
</el-card> </el-card>

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

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

Loading…
Cancel
Save