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 | 45 ++++++++++++++++++++++++++++++++++++++------- 1 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/views/project/ch/home/ScenarioDetails.vue b/src/views/project/ch/home/ScenarioDetails.vue index 76cc9ee..7162550 100644 --- a/src/views/project/ch/home/ScenarioDetails.vue +++ b/src/views/project/ch/home/ScenarioDetails.vue @@ -6,9 +6,9 @@ <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-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> @@ -46,11 +46,11 @@ </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"> @@ -63,8 +63,10 @@ <script setup lang="ts"> import type { FormRules } from 'element-plus'; -import { onMounted, reactive } from 'vue'; -import { getBigModelList } from '/@/api/ai/chat'; +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: [], @@ -92,20 +94,49 @@ }, ], 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 = () => {}; +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> -- Gitblit v1.9.3