yangyin
2024-11-22 33710b80001f533b8dc094e671f20299ddf99d4c
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
@@ -33,11 +33,7 @@
                           popper-class="custom-select-style"
                           :teleported="false"
                        >
                           <el-option v-for="item in state.modelTypeList" :key="item.ID" :label="item.Name" :value="item.Name">
                              <!-- <div style="max-width: 200px !important; display: flex; flex-wrap: wrap; margin-bottom: 10px">
                                 {{ item.Name }}
                              </div> -->
                           </el-option>
                           <el-option v-for="item in state.modelTypeList" :key="item.ID" :label="item.Name" :value="item.Name"> </el-option>
                        </el-select>
                     </el-form-item>
                     <el-form-item label="补充内容" prop="supplementContenT">
@@ -50,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">
@@ -67,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: '端吸泵EN733',
         SeriesID: '2,41,18,4,42,26',
      },
      {
         ID: 7,
         Name: '端吸泵ISO2858',
         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: '消防泵EHF',
         SeriesID: '15',
      },
      {
         ID: 8,
         Name: '消防泵ESF',
         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: '',
@@ -146,13 +94,51 @@
      },
   ],
   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: '', //当前问题对应的sample_id(可不填或为空)
      llm_id: state.llm_id ? state.llm_id : '', //当前问题对应的llm_id(不填则用缺省llm)
      history_group_id: activeRoomId.value, //当前问题对应的history group id
      raw_mode: true, //是否直接调用大模型回答问题(不填为false)
      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 {