<template>
|
<div class="pc-detail w100 h100 box-border">
|
<div class="w100 h100 grid box-border set-body">
|
<div class="left">
|
<div class="p-[32px]">
|
<div class="flex justify-between items-center">
|
<div class="flex items-center">
|
<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" @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
|
ref="modelFormRef"
|
: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" clearable />
|
</el-form-item>
|
<el-form-item label="类型" prop="modelType">
|
<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>
|
<el-form-item label="补充内容" prop="supplementContenT">
|
<el-input v-model="state.modelForm.supplementContenT" type="textarea" :rows="6" />
|
</el-form-item>
|
<div class="pt-[60px] text-right">
|
<el-button type="primary" @click="handleSubmit" size="large">立即生成</el-button>
|
</div>
|
</el-form>
|
</div>
|
</div>
|
</div>
|
<div class="right" v-loading="state.contentLoading">
|
<div class="top">
|
<div class="left">
|
<i></i>
|
<span>{{ state.select_name ? state.select_name : '' }}总结</span>
|
</div>
|
</div>
|
<div class="output">
|
<p class="placeholder">{{ state.workContent }}</p>
|
</div>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<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({
|
seriesModel: '',
|
modelOptionList: [],
|
modelForm: {
|
theme: '',
|
modelType: '',
|
supplementContenT: '',
|
},
|
modelTypeList: [
|
{
|
ID: 1,
|
Name: '日总结',
|
},
|
{
|
ID: 2,
|
Name: '周总结',
|
},
|
{
|
ID: 3,
|
Name: '月度总结',
|
},
|
{
|
ID: 4,
|
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 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 {
|
padding: 74px 32px 42px;
|
font-size: 14px;
|
font-family: var(--fontFamily);
|
display: flex;
|
-webkit-box-orient: vertical;
|
-webkit-box-direction: normal;
|
-ms-flex-direction: column;
|
flex-direction: column;
|
position: relative;
|
.set-body {
|
grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
|
grid-template-rows: minmax(0, 1fr);
|
column-gap: 20px;
|
.left {
|
text-align: center;
|
height: 100%;
|
background-color: #fff;
|
border-radius: 8px;
|
overflow-y: auto;
|
box-shadow: 0 0 1px rgba(0, 0, 0, 0.16);
|
.model_right {
|
min-width: 230px;
|
height: 36px;
|
border-radius: 8px;
|
border: 1px solid #d8dae5;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
cursor: pointer;
|
}
|
}
|
.right {
|
height: 100%;
|
background-color: #fff;
|
box-shadow: 0 0 1px rgba(0, 0, 0, 0.16);
|
border-radius: 8px;
|
.top {
|
margin: 0 32px;
|
display: flex;
|
justify-content: space-between;
|
padding: 32px 0;
|
.left {
|
display: flex;
|
align-items: center;
|
i {
|
width: 4px;
|
height: 14px;
|
background: #1c86ff;
|
border-radius: 0 100px 100px 0;
|
margin-right: 10px;
|
}
|
}
|
}
|
.output {
|
box-sizing: border-box;
|
height: calc(100% - 132px);
|
max-height: calc(100% - 132px);
|
overflow-y: auto;
|
padding: 10px;
|
line-height: 25px;
|
border-radius: 10px;
|
background: #fff;
|
border: 1px solid #eee;
|
position: relative;
|
margin: 0 32px;
|
.placeholder {
|
position: absolute;
|
top: 12px;
|
left: 12px;
|
z-index: 10;
|
font-size: 14px;
|
color: #838383;
|
}
|
}
|
}
|
}
|
}
|
:deep(.el-select-dropdown__list) {
|
max-width: 700px !important;
|
display: flex;
|
flex-wrap: wrap;
|
margin-bottom: 10px;
|
}
|
.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>
|