From 84b354e6c60464d3c9e71b1e386fbd2deb70e970 Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期日, 30 六月 2024 11:25:54 +0800
Subject: [PATCH] fix: 联调主场景

---
 src/api/ai/chat.ts                                        |  103 +++++++++++++++++-----------------
 src/views/project/ch/home/component/waterRight/bottom.vue |   76 +++++++++++++++---------
 2 files changed, 99 insertions(+), 80 deletions(-)

diff --git a/src/api/ai/chat.ts b/src/api/ai/chat.ts
index 2b06a5c..2bc9d53 100644
--- a/src/api/ai/chat.ts
+++ b/src/api/ai/chat.ts
@@ -2,44 +2,43 @@
 import { toFormData } from '/@/utils/util';
 
 //#region ====================== knowledge ======================
-	
+
 export interface KnowledgeRes {
-    json_ok:     boolean;
-    question:    string;
-    answer_type: string;
-    knowledge:   KnowledgeData[];
+	json_ok: boolean;
+	question: string;
+	answer_type: string;
+	knowledge: KnowledgeData[];
 }
 
 export interface KnowledgeData {
-    answer:   string;
-    contexts: Context[];
+	answer: string;
+	contexts: Context[];
 }
 
 export interface Context {
-    page_content: string;
-    metadata:     Metadata;
+	page_content: string;
+	metadata: Metadata;
 }
 
 export interface Metadata {
-    Title?: string;
+	Title?: string;
 }
 
 //#endregion
 
-
 //#region ====================== RecordSet ======================
 export interface RecordSetRes {
-    json_ok:     boolean;
-    question:    string;
-    answer_type: string;
-    values:      RecordSetValues;
+	json_ok: boolean;
+	question: string;
+	answer_type: string;
+	values: RecordSetValues;
 }
 
 export interface RecordSetValues {
-    names:  string[];
-    values: Array<Array<any>>;
-    type:   string;
-    title:  string;
+	names: string[];
+	values: Array<Array<any>>;
+	type: string;
+	title: string;
 }
 
 //#endregion
@@ -104,46 +103,48 @@
 	});
 };
 
-
-
-
+/**
+ * @summary  鑾峰彇涓诲満鏅�
+ */
+export const getSectionList = async (req: any = request) => {
+	return req({
+		url: '/section/get_section_a_list',
+		method: 'POST',
+	});
+};
 
 /**
  * @summary description
  */
-export const CreateHistoryGroup = async (params, req:any = request) => {
-  return req({
-	url: "/history/create_history_group",
-	method: "POST",
-	data: params,
-	headers: {
-		'Content-Type': 'application/x-www-form-urlencoded',
-	},
-  });
+export const CreateHistoryGroup = async (params, req: any = request) => {
+	return req({
+		url: '/history/create_history_group',
+		method: 'POST',
+		data: params,
+		headers: {
+			'Content-Type': 'application/x-www-form-urlencoded',
+		},
+	});
 };
 
-
-export const GetHistoryGroups = async (params, req:any = request) => {
+export const GetHistoryGroups = async (params, req: any = request) => {
 	return req({
-	  url: "/history/get_history_groups",
-	  method: "POST",
-	  data: params,
-	  headers: {
-		  'Content-Type': 'application/x-www-form-urlencoded',
-	  },
+		url: '/history/get_history_groups',
+		method: 'POST',
+		data: params,
+		headers: {
+			'Content-Type': 'application/x-www-form-urlencoded',
+		},
 	});
-  };
+};
 
-
-  
-
-export const QueryHistoryGroup = async (params, req:any = request) => {
+export const QueryHistoryGroup = async (params, req: any = request) => {
 	return req({
-	  url: "/history/query_history_detail",
-	  method: "POST",
-	  data: params,
-	  headers: {
-		  'Content-Type': 'application/x-www-form-urlencoded',
-	  },
+		url: '/history/query_history_detail',
+		method: 'POST',
+		data: params,
+		headers: {
+			'Content-Type': 'application/x-www-form-urlencoded',
+		},
 	});
-  };
+};
diff --git a/src/views/project/ch/home/component/waterRight/bottom.vue b/src/views/project/ch/home/component/waterRight/bottom.vue
index 02eb624..8c73d03 100644
--- a/src/views/project/ch/home/component/waterRight/bottom.vue
+++ b/src/views/project/ch/home/component/waterRight/bottom.vue
@@ -18,15 +18,15 @@
 			<div
 				class="main_item flex cursor-pointer"
 				v-for="(item, index) in state.applicationScenarios"
-				:key="item.ID"
-				:class="{ main_item_active: item.ID === state.scenariosIndex }"
+				:key="item.section_id"
+				:class="{ main_item_active: item.section_id === state.scenariosIndex }"
 				@click="changeScenarios(item)"
 			>
 				<div :class="['iconfont icon-' + item.Icon]"></div>
 
 				<div class="right">
-					<h4>{{ item.Title }}</h4>
-					<p>{{ item.Content }}</p>
+					<h4>{{ item.section_name }}</h4>
+					<p>{{ item.section_title }}</p>
 				</div>
 			</div>
 		</div>
@@ -34,46 +34,64 @@
 </template>
 
 <script setup lang="ts">
-import { reactive } from 'vue';
+import { onMounted, reactive } from 'vue';
+import { getSectionList } from '/@/api/ai/chat';
 import router from '/@/router';
+
 let state = reactive({
 	applicationScenarios: [
-		{
-			ID: 1,
-			Icon: 'biaodan',
-			Title: '琛屼笟鐭ヨ瘑搴�',
-			Content: '寮犱笁鎵撲簡鏉庡洓涓�宸存帉,鏉庡洓瀵瑰紶涓夎:"浣犳槸涓嶆槸娌″悆楗�",鏉庡洓璇磋繖鍙ヨ瘽鍚箟鏄�?',
-		},
-		{
-			ID: 2,
-			Icon: 'putong',
-			Title: '鐢熶骇璋冨害',
-			Content: '鎬庝箞瑙i噴鍔姏鍜屽唴鍗风殑鍖哄埆?',
-		},
-		{
-			ID: 3,
-			Icon: 'zhongduancanshuchaxun',
-			Title: '姘翠骇鐢熶骇',
-			Content: '璇锋悳绱綘鎯崇煡閬撶殑闂',
-		},
-		{
-			ID: 4,
-			Icon: 'tuichuquanping',
-			Title: '绠$綉杩愯',
-			Content: '璇蜂互璇楃粡涓殑鍏告晠缁欑敺瀹濆疂鍙栧悕锛屽椤撅紝鍚嶅瓧瑕佹眰3涓瓧锛岀粰5涓悕瀛椾緵鎴戦�夋嫨銆�',
-		},
+		// {
+		// 	ID: 1,
+		// 	Icon: 'biaodan',
+		// 	Title: '琛屼笟鐭ヨ瘑搴�',
+		// 	Content: '寮犱笁鎵撲簡鏉庡洓涓�宸存帉,鏉庡洓瀵瑰紶涓夎:"浣犳槸涓嶆槸娌″悆楗�",鏉庡洓璇磋繖鍙ヨ瘽鍚箟鏄�?',
+		// },
+		// {
+		// 	ID: 2,
+		// 	Icon: 'putong',
+		// 	Title: '鐢熶骇璋冨害',
+		// 	Content: '鎬庝箞瑙i噴鍔姏鍜屽唴鍗风殑鍖哄埆?',
+		// },
+		// {
+		// 	ID: 3,
+		// 	Icon: 'zhongduancanshuchaxun',
+		// 	Title: '姘翠骇鐢熶骇',
+		// 	Content: '璇锋悳绱綘鎯崇煡閬撶殑闂',
+		// },
+		// {
+		// 	ID: 4,
+		// 	Icon: 'tuichuquanping',
+		// 	Title: '绠$綉杩愯',
+		// 	Content: '璇蜂互璇楃粡涓殑鍏告晠缁欑敺瀹濆疂鍙栧悕锛屽椤撅紝鍚嶅瓧瑕佹眰3涓瓧锛岀粰5涓悕瀛椾緵鎴戦�夋嫨銆�',
+		// },
 	],
+	scenariosIds: [],
 	scenariosIndex: 0,
 });
 const changeScenarios = (item) => {
 	state.scenariosIndex = item.ID;
 };
+const getMainSectionList = async () => {
+	const res = await getSectionList();
+	let result = res.sections;
+	const iconList = ['biaodan', 'putong', 'zhongduancanshuchaxun', 'shidu'];
+	res.sections.forEach((sectionItem, index) => {
+		sectionItem.Icon = iconList[index];
+	});
+	state.applicationScenarios = res.sections;
+	console.log('馃殌 ~ state.applicationScenarios:', state.applicationScenarios);
+	state.scenariosIds = result.map((item) => item.ID);
+};
+
 // 鏌ョ湅鏇村
 const lookMore = () => {
 	router.push({
 		name: 'Scenario',
 	});
 };
+onMounted(() => {
+	getMainSectionList();
+});
 </script>
 <style scoped lang="scss">
 .pc-scenes {

--
Gitblit v1.9.3