From 542b404c51f67b8fb9e56ed0ba0562e31af7d257 Mon Sep 17 00:00:00 2001 From: gerson <1405270578@qq.com> Date: 星期六, 06 七月 2024 18:52:47 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/WI/Web.V1.0 --- src/views/project/ch/home/ScenarioDetails.vue | 132 +++++++++++++++++++++++-------------------- 1 files changed, 71 insertions(+), 61 deletions(-) diff --git a/src/views/project/ch/home/ScenarioDetails.vue b/src/views/project/ch/home/ScenarioDetails.vue index e4b1318..7162550 100644 --- a/src/views/project/ch/home/ScenarioDetails.vue +++ b/src/views/project/ch/home/ScenarioDetails.vue @@ -6,10 +6,10 @@ <div class="flex justify-between items-center"> <div class="flex items-center"> <i class="ywicon icon-gongzuozongjie text-[#1c86ff]" style="font-size: 20px !important"></i> - <span class="text-[14px] text-[#000] leading-5 ml-1">宸ヤ綔鎬荤粨</span> + <span class="text-[14px] text-[#000] leading-5 ml-1">{{ state.select_name ? state.select_name : '' }}</span> </div> - <el-select v-model="state.seriesModel" placeholder="璇烽�夋嫨" size="large"> - <el-option v-for="item in state.modelOptionList" :key="item.ID" :label="item.Name" :value="item.Name" /> + <el-select v-model="state.seriesModel" placeholder="璇烽�夋嫨" size="large" @change="handleModelChange"> + <el-option v-for="item in state.modelOptionList" :key="item.id" :label="item.title" :value="item.id" /> </el-select> </div> <div class="pt-[30px]"> @@ -18,30 +18,39 @@ :model="state.modelForm" :rules="modelRules" label-width="auto" + class="custom-form" label-position="top" status-icon size="large" > <el-form-item label="涓婚" prop="theme"> - <el-input v-model="state.modelForm.theme" /> + <el-input v-model="state.modelForm.theme" clearable /> </el-form-item> <el-form-item label="绫诲瀷" prop="modelType"> - <el-select v-model="state.modelForm.modelType" placeholder="璇烽�夋嫨绫诲瀷" popper-class="custom-select-style"> + <el-select + v-model="state.modelForm.modelType" + placeholder="璇烽�夋嫨绫诲瀷" + popper-class="custom-select-style" + :teleported="false" + > <el-option v-for="item in state.modelTypeList" :key="item.ID" :label="item.Name" :value="item.Name"> </el-option> </el-select> </el-form-item> <el-form-item label="琛ュ厖鍐呭" prop="supplementContenT"> <el-input v-model="state.modelForm.supplementContenT" type="textarea" :rows="6" /> </el-form-item> + <div class="pt-[60px] text-right"> + <el-button type="primary" @click="handleSubmit" size="large">绔嬪嵆鐢熸垚</el-button> + </div> </el-form> </div> </div> </div> - <div class="right"> + <div class="right" v-loading="state.contentLoading"> <div class="top"> <div class="left"> <i></i> - <span>宸ヤ綔鎬荤粨</span> + <span>{{ state.select_name ? state.select_name : '' }}鎬荤粨</span> </div> </div> <div class="output"> @@ -54,61 +63,13 @@ <script setup lang="ts"> import type { FormRules } from 'element-plus'; -import { reactive } from 'vue'; +import { onMounted, reactive, ref } from 'vue'; +import { useRoute } from 'vue-router'; +import { QuestionWorkAi, getBigModelList } from '/@/api/ai/chat'; +import { activeRoomId, activeSectionAId } from '/@/stores/chatRoom'; let state = reactive({ seriesModel: '', - modelOptionList: [ - { - ID: 2, - Name: '绔惛娉礒N733', - SeriesID: '2,41,18,4,42,26', - }, - { - ID: 7, - Name: '绔惛娉礗SO2858', - SeriesID: '12,47,14,48', - }, - { - ID: 3, - Name: '鍙屽惛娉�', - SeriesID: '30,29,3,28,40,44', - }, - { - ID: 4, - Name: '绠¢亾娉�', - SeriesID: '6,51,5,46', - }, - { - ID: 6, - Name: '娑堥槻娉礒HF', - SeriesID: '15', - }, - { - ID: 8, - Name: '娑堥槻娉礒SF', - SeriesID: '16', - }, - { - ID: 5, - Name: '鑷惛姹℃按娉�', - SeriesID: '8', - }, - { - ID: 9, - Name: '绔惛娉电數鏈虹洿杩�', - SeriesID: '33,38,35,37', - }, - { - ID: 10, - Name: '绔嬪紡澶氱骇娉�', - SeriesID: '60,61', - }, - { - ID: 11, - Name: '鍗曠骇绠¢亾娉�', - SeriesID: '59', - }, - ], + modelOptionList: [], modelForm: { theme: '', modelType: '', @@ -129,15 +90,54 @@ }, { ID: 4, - Name: '鍛ㄦ�荤粨', + Name: '閮ㄩ棬鎬荤粨', }, ], workContent: '鍦ㄥ乏渚ц緭鍏ュ唴瀹瑰苟鎻愪氦锛屽皢鑷姩涓烘偍鐢熸垚宸ヤ綔鎬荤粨', + llm_id: '', + select_question: null, + select_name: null, + contentLoading: false, }); const modelRules = reactive<FormRules>({ theme: [{ required: true, message: '蹇呭~椤�', trigger: 'blur' }], supplementContenT: [{ required: true, message: '蹇呭~椤�', trigger: 'blur' }], modelType: [{ required: true, message: '蹇呭~椤�', trigger: 'change' }], +}); +const modelFormRef = ref(null); +//鑾峰彇澶фā鍨嬪垪琛� +const getModelList = async () => { + const res = await getBigModelList(); + state.modelOptionList = res.llm_list || []; +}; +//鍒囨崲妯″瀷 +const handleModelChange = async (val: string) => { + state.llm_id = val; +}; +//绔嬪嵆鐢熸垚 +const handleSubmit = async () => { + const valid = await modelFormRef.value.validate().catch(() => {}); + if (!valid) return; + state.contentLoading = true; + const res = await QuestionWorkAi({ + section_a_id: activeSectionAId.value, //褰撳墠闂瀵瑰簲鐨勪富鍦烘櫙 + sample_id: '', //褰撳墠闂瀵瑰簲鐨剆ample_id(鍙笉濉垨涓虹┖) + llm_id: state.llm_id ? state.llm_id : '', //褰撳墠闂瀵瑰簲鐨刲lm_id(涓嶅~鍒欑敤缂虹渷llm) + history_group_id: activeRoomId.value, //褰撳墠闂瀵瑰簲鐨刪istory group id + raw_mode: true, //鏄惁鐩存帴璋冪敤澶фā鍨嬪洖绛旈棶棰�(涓嶅~涓篺alse) + question: state.select_question, //鎻愬嚭鐨勯棶棰� + }).finally(() => { + state.contentLoading = false; + }); + state.workContent = res.answer; +}; +onMounted(() => { + const route = useRoute(); + const pathInfo = route.query; + activeSectionAId.value = pathInfo.ID; + state.select_question = pathInfo.Title; + state.select_name = pathInfo.Name; + getModelList(); }); </script> <style scoped lang="scss"> @@ -219,6 +219,12 @@ } } } +:deep(.el-select-dropdown__list) { + max-width: 700px !important; + display: flex; + flex-wrap: wrap; + margin-bottom: 10px; +} .custom-select-style .el-select-dropdown__item { height: 32px; background: #eaf4ff; @@ -227,4 +233,8 @@ font-size: 14px; padding: 0 20px; } +.custom-select-style .el-select-dropdown__item.selected { + color: #409eff !important; + font-weight: 700; +} </style> -- Gitblit v1.9.3