From 013ba12301b81015e8023120a7ead3c646d4d28c Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期五, 05 七月 2024 17:41:18 +0800
Subject: [PATCH] fix: 修改应用场景详情

---
 src/views/project/ch/home/ScenarioDetails.vue |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/views/project/ch/home/ScenarioDetails.vue b/src/views/project/ch/home/ScenarioDetails.vue
index 8ef77c8..7162550 100644
--- a/src/views/project/ch/home/ScenarioDetails.vue
+++ b/src/views/project/ch/home/ScenarioDetails.vue
@@ -6,7 +6,7 @@
 					<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" @change="handleModelChange">
 							<el-option v-for="item in state.modelOptionList" :key="item.id" :label="item.title" :value="item.id" />
@@ -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">
@@ -64,6 +64,7 @@
 <script setup lang="ts">
 import type { FormRules } from 'element-plus';
 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({
@@ -94,6 +95,9 @@
 	],
 	workContent: '鍦ㄥ乏渚ц緭鍏ュ唴瀹瑰苟鎻愪氦锛屽皢鑷姩涓烘偍鐢熸垚宸ヤ綔鎬荤粨',
 	llm_id: '',
+	select_question: null,
+	select_name: null,
+	contentLoading: false,
 });
 const modelRules = reactive<FormRules>({
 	theme: [{ required: true, message: '蹇呭~椤�', trigger: 'blur' }],
@@ -114,21 +118,25 @@
 const handleSubmit = async () => {
 	const valid = await modelFormRef.value.validate().catch(() => {});
 	if (!valid) return;
-	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: '', //鎻愬嚭鐨勯棶棰�
+		question: state.select_question, //鎻愬嚭鐨勯棶棰�
+	}).finally(() => {
+		state.contentLoading = false;
 	});
-	const { theme, modelType, supplementContenT } = state.modelForm;
-	const modelTypeText = state.modelTypeList.find((item) => item.Name === modelType)?.Name || '';
-	const content = `## ${theme} ${modelTypeText}\n${supplementContenT}`;
-	state.workContent = content;
+	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