From 33710b80001f533b8dc094e671f20299ddf99d4c Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期五, 22 十一月 2024 11:17:26 +0800
Subject: [PATCH] 提交代码

---
 src/views/project/ch/home/ScenarioDetails.vue |  150 +++++++++++++++++++++++--------------------------
 1 files changed, 71 insertions(+), 79 deletions(-)

diff --git a/src/views/project/ch/home/ScenarioDetails.vue b/src/views/project/ch/home/ScenarioDetails.vue
index ae86048..76fdac9 100644
--- a/src/views/project/ch/home/ScenarioDetails.vue
+++ b/src/views/project/ch/home/ScenarioDetails.vue
@@ -5,12 +5,12 @@
 				<div class="p-[32px]">
 					<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>
+							<i class="ywifont ywicon-gongzuozongjie text-[#1c86ff]" style="font-size: 20px !important"></i>
+							<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>
+						<!-- <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]">
 						<el-form
@@ -18,15 +18,21 @@
 							: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>
@@ -40,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">
@@ -57,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: '',
@@ -132,17 +90,55 @@
 		},
 		{
 			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 handleSubmit = () => {};
+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">
 .pc-detail {
@@ -229,20 +225,16 @@
 	flex-wrap: wrap;
 	margin-bottom: 10px;
 }
-.custom-select-style {
-	.el-select-dropdown__list {
-		max-width: 700px !important;
-		display: flex;
-		flex-wrap: wrap;
-		margin-bottom: 10px;
-	}
-	.el-select-dropdown__item {
-		height: 32px;
-		background: #eaf4ff;
-		border-radius: 8px;
-		margin: 5px;
-		font-size: 14px;
-		padding: 0 20px;
-	}
+.custom-select-style .el-select-dropdown__item {
+	height: 32px;
+	background: #eaf4ff;
+	border-radius: 8px;
+	margin: 5px;
+	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