From 30878d21b5fa4580da01cb87a7683fe7fa9afcb2 Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期日, 30 六月 2024 12:25:21 +0800
Subject: [PATCH] fix: 联调次场景

---
 src/views/project/ch/home/component/waterRight/top.vue |   57 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/src/views/project/ch/home/component/waterRight/top.vue b/src/views/project/ch/home/component/waterRight/top.vue
index be9499e..b08ca14 100644
--- a/src/views/project/ch/home/component/waterRight/top.vue
+++ b/src/views/project/ch/home/component/waterRight/top.vue
@@ -4,13 +4,17 @@
 		<p class="set-waterTitle"><strong>WI 姘村姟鏅鸿兘涓撳</strong>鏅烘収姘村姟鍔╂墜</p>
 	</div>
 	<div class="flex items-center pc-roleList">
-		<div v-for="(item, index) in state.roleList" :key="index" class="flex items-center pl-6" @click="handleClick(item)">
-			<el-tooltip :content="item.Content" placement="top" effect="light" popper-class="my-pop">
-				<div class="modelItem cursor-pointer flex items-center" :class="{ modelItemActive: item.ID === state.activeRole }">
+		<div v-for="(item, index) in llmList" :key="item.logicId" class="flex items-center pl-6" @click="handleClick(item)">
+			<div class="modelItem cursor-pointer flex items-center" :class="{ modelItemActive: item.logicId === activeLLMId }">
+				<img :src="item.icon" alt="icon" class="set-icon box-border" />
+				<span>{{ item.logicTitle }}</span>
+			</div>
+			<!-- <el-tooltip :content="item.Content" placement="top" effect="light" popper-class="my-pop">
+				<div class="modelItem cursor-pointer flex items-center " :class="{ modelItemActive: item.ID === state.activeRole }">
 					<img :src="item.Icon" alt="icon" class="set-icon box-border" />
 					<span>{{ item.Title }}</span>
 				</div>
-			</el-tooltip>
+			</el-tooltip> -->
 		</div>
 		<div class="flex items-center cursor-pointer pl-5">
 			<div class="modelItem cursor-pointer flex items-center">
@@ -23,7 +27,8 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue';
+import { onMounted, reactive, ref } from 'vue';
+import { GetLLMList, SetLLM } from '/@/api/ai/chat';
 import PlayBar from '/@/components/chat/components/playBar/PlayBar.vue';
 import router from '/@/router';
 import { activeChatRoom } from '/@/stores/chatRoom';
@@ -61,11 +66,47 @@
 		},
 	],
 	activeRole: 0,
-	inputAnswer: '',
 });
-const handleClick = (item) => {
-	state.activeRole = item.id;
+
+const activeLLMId = ref();
+const llmList = ref([]);
+const iconList = ['/static/images/wave/Glm.jpg', '/static/images/wave/Glm.jpg', '/static/images/wave/Glm.jpg'];
+const getLLMList = async () => {
+	const res = await GetLLMList();
+
+	const resData = (res?.llm_list || []) as any[];
+	llmList.value = resData.map((item, index) => ({
+		get logicId() {
+			return this.logicModel.id;
+		},
+		get logicTitle() {
+			return this.logicModel.title;
+		},
+		icon: iconList[index],
+		logicModel: {
+			...item,
+		},
+	}));
+	const first = llmList.value?.[0];
+	first && setLLm(first.logicId);
 };
+
+const setLLm = async (llmId: string) => {
+	
+	// const res = await SetLLM({
+	// 	llm: llmId,
+	// });
+	activeLLMId.value = llmId;
+
+	return true;
+};
+const handleClick = (item) => {
+	setLLm(item.logicId);
+};
+
+onMounted(() => {
+	getLLMList();
+});
 </script>
 <style scoped lang="scss">
 .set-waterTitle {

--
Gitblit v1.9.3