|
@@ -24,72 +24,46 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-scrollbar>
|
|
</el-scrollbar>
|
|
- <div style="display: flex;gap: 4px;padding: 1rem;">
|
|
|
|
- <!-- <el-check-tag :checked="type === '1'" @change="type = '1'">文档总结</el-check-tag> -->
|
|
|
|
- <el-check-tag :disabled="!taklToHtml" :checked="type === '2'" @change="() => {
|
|
|
|
- if (type !== '2') {
|
|
|
|
- inputMessage = '/智能填表 '
|
|
|
|
- type = '2'
|
|
|
|
- } else {
|
|
|
|
- type = ''
|
|
|
|
- }
|
|
|
|
- }">
|
|
|
|
- <el-tooltip content="选择后,在输入框描述填表流程" placement="top">
|
|
|
|
- 智能填表
|
|
|
|
- </el-tooltip>
|
|
|
|
- </el-check-tag>
|
|
|
|
- </div>
|
|
|
|
|
|
+
|
|
<Tools @read-click="isShowPage = true, taklToHtml = true" @upload-file="handleUpload" />
|
|
<Tools @read-click="isShowPage = true, taklToHtml = true" @upload-file="handleUpload" />
|
|
|
|
|
|
<div>
|
|
<div>
|
|
- <div v-show="isShowPage">
|
|
|
|
- <span style="margin-left: 12px;margin-bottom: 6px;">
|
|
|
|
- <el-tooltip content="开启后,将会根据左侧网页中的内容做出回答" placement="top">
|
|
|
|
- <el-switch size="small" v-model="taklToHtml" />
|
|
|
|
- </el-tooltip> 与页面对话
|
|
|
|
- </span>
|
|
|
|
-
|
|
|
|
- <div class="card-content">
|
|
|
|
- <img :src="pageInfo?.favIconUrl" style="width: 24px;" />
|
|
|
|
- <div class="title-wrapper">
|
|
|
|
- <div class="title-scroller" :class="{ 'scroll': isHoveringTitle && titleScroll }">
|
|
|
|
- {{ pageInfo?.title }}
|
|
|
|
|
|
+ <!-- 输入区域 -->
|
|
|
|
+ <div class="input-area">
|
|
|
|
+ <div v-show="isShowPage" style="border-bottom: 1px solid #F0F0F0;">
|
|
|
|
+ <div class="card-content">
|
|
|
|
+ <img :src="pageInfo?.favIconUrl" style="width: 24px;" />
|
|
|
|
+ <div class="title-wrapper">
|
|
|
|
+ <div class="title-scroller" :class="{ 'scroll': isHoveringTitle && titleScroll }">
|
|
|
|
+ {{ pageInfo?.title }}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <el-icon size="16px" @click="isShowPage = false; taklToHtml = false">
|
|
|
|
+ <CircleClose />
|
|
|
|
+ </el-icon>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="card-btn">
|
|
|
|
+ <el-tooltip content="总结当前页面" placement="top">
|
|
|
|
+ <el-button round @click="handleCardButtonClick" :disabled="!taklToHtml">总结</el-button>
|
|
|
|
+ </el-tooltip>
|
|
|
|
+
|
|
|
|
+ <el-tooltip content="选择后,在输入框描述填表流程" placement="top">
|
|
|
|
+ <el-button round @click="handelIntelligentFillingClick" :disabled="!taklToHtml">智能填表</el-button>
|
|
|
|
+ </el-tooltip>
|
|
</div>
|
|
</div>
|
|
- <el-icon size="16px" @click="isShowPage = false">
|
|
|
|
- <CircleClose />
|
|
|
|
- </el-icon>
|
|
|
|
- </div>
|
|
|
|
- <div class="card-btn">
|
|
|
|
- <el-button class="op" link @click="handleCardButtonClick" :disabled="!taklToHtml">总结</el-button>
|
|
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- <!-- 输入区域 -->
|
|
|
|
- <div class="input-area">
|
|
|
|
- <el-input v-model="inputMessage" type="textarea" :rows="2" placeholder="输入消息..." @keyup.enter="() => {
|
|
|
|
|
|
+
|
|
|
|
+ <el-input ref="textareaRef" v-model="inputMessage" type="textarea" :rows="3" placeholder="输入消息..." @keyup.enter="() => {
|
|
addMessage(inputMessage.trim(), true)
|
|
addMessage(inputMessage.trim(), true)
|
|
inputMessage = ''
|
|
inputMessage = ''
|
|
}" />
|
|
}" />
|
|
- <div>
|
|
|
|
- <div style="display: flex;justify-content: space-between;">
|
|
|
|
- <!-- <el-upload :before-upload="file => handleUpload(file)" :multiple="false"
|
|
|
|
- :class="['upload', { 'can-hover': taklToHtml }]" name="file" :show-file-list="false" :accept="'.xlsx'"
|
|
|
|
- :disabled="!taklToHtml">
|
|
|
|
- <el-icon size="24" :color="taklToHtml ? 'gray' : '#c0c4cc'" style="cursor: pointer;">
|
|
|
|
- <Upload />
|
|
|
|
- </el-icon>
|
|
|
|
- </el-upload> -->
|
|
|
|
-
|
|
|
|
- <el-button size="small" type="primary" @click="() => {
|
|
|
|
- addMessage(inputMessage.trim(), true)
|
|
|
|
- inputMessage = ''
|
|
|
|
- }"
|
|
|
|
- :disabled="!inputMessage.trim() || sendLoading">
|
|
|
|
- 发送
|
|
|
|
- </el-button>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div class="chat_area_op">
|
|
|
|
+ <el-button type="primary" link @click="handleAsk" :disabled="!inputMessage.trim() || sendLoading">
|
|
|
|
+ <el-icon size="18" :color="inputMessage.trim() ? 'black' : 'gray'">
|
|
|
|
+ <Promotion />
|
|
|
|
+ </el-icon>
|
|
|
|
+ </el-button>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
@@ -97,23 +71,25 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { ref, onMounted, nextTick, inject } from 'vue'
|
|
|
|
|
|
+import { ref, onMounted, nextTick, inject, useTemplateRef } from 'vue'
|
|
import { ElScrollbar, ElAvatar, ElInput, ElButton } from 'element-plus'
|
|
import { ElScrollbar, ElAvatar, ElInput, ElButton } from 'element-plus'
|
|
import avator from '@/public/icon/32.png'
|
|
import avator from '@/public/icon/32.png'
|
|
import moment from 'moment'
|
|
import moment from 'moment'
|
|
-import { buildExcelUnderstandingPrompt } from '@/utils/ai-service.js'
|
|
|
|
|
|
+import { buildExcelUnderstandingPrompt } from '@/utils/ai-service.js'
|
|
import * as XLSX from "xlsx";
|
|
import * as XLSX from "xlsx";
|
|
import { ElMessage } from 'element-plus';
|
|
import { ElMessage } from 'element-plus';
|
|
import { useMsg } from '@/entrypoints/sidepanel/hook/useMsg.ts';
|
|
import { useMsg } from '@/entrypoints/sidepanel/hook/useMsg.ts';
|
|
import Tools from "@/entrypoints/sidepanel/component/tools.vue";
|
|
import Tools from "@/entrypoints/sidepanel/component/tools.vue";
|
|
import { useSummary } from '@/entrypoints/sidepanel/hook/useSummary.ts'
|
|
import { useSummary } from '@/entrypoints/sidepanel/hook/useSummary.ts'
|
|
import { mockData } from "@/entrypoints/sidepanel/mock"
|
|
import { mockData } from "@/entrypoints/sidepanel/mock"
|
|
|
|
+import { useAutoResizeTextarea } from '@/entrypoints/sidepanel/hook/useAutoResizeTextarea.ts';
|
|
|
|
|
|
// 滚动条引用
|
|
// 滚动条引用
|
|
const scrollbar = ref(null);
|
|
const scrollbar = ref(null);
|
|
const type = ref('');
|
|
const type = ref('');
|
|
const xlsxData = ref({});
|
|
const xlsxData = ref({});
|
|
const isShowPage = ref(false);
|
|
const isShowPage = ref(false);
|
|
|
|
+const tareRef = useTemplateRef("textareaRef");
|
|
const {
|
|
const {
|
|
messages,
|
|
messages,
|
|
inputMessage,
|
|
inputMessage,
|
|
@@ -129,13 +105,19 @@ const {
|
|
} = useMsg(scrollbar, type, xlsxData, fetchDataAndProcess);
|
|
} = useMsg(scrollbar, type, xlsxData, fetchDataAndProcess);
|
|
const { handleCardButtonClick } = useSummary(addMessage, sendRequese);
|
|
const { handleCardButtonClick } = useSummary(addMessage, sendRequese);
|
|
|
|
|
|
|
|
+function handelIntelligentFillingClick() {
|
|
|
|
+ if (type.value !== '2') {
|
|
|
|
+ inputMessage.value = '/智能填表 '
|
|
|
|
+ type.value = '2'
|
|
|
|
+ } else {
|
|
|
|
+ type.value = ''
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
-
|
|
|
|
-// const pageInfo = ref({})
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// 输入框内容
|
|
|
|
-// const inputMessage = ref('')
|
|
|
|
|
|
+function handleAsk() {
|
|
|
|
+ addMessage(inputMessage.value.trim(), true);
|
|
|
|
+ inputMessage.value = '';
|
|
|
|
+}
|
|
|
|
|
|
// 计算标题是否需要滚动
|
|
// 计算标题是否需要滚动
|
|
const titleScroll = computed(() => {
|
|
const titleScroll = computed(() => {
|
|
@@ -268,6 +250,7 @@ const isHoveringTitle = ref(false)
|
|
|
|
|
|
// 组件挂载时滚动到底部
|
|
// 组件挂载时滚动到底部
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
|
+ useAutoResizeTextarea(tareRef, inputMessage);
|
|
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
if (message.type === 'TO_SIDE_PANEL_PAGE_INFO') {
|
|
if (message.type === 'TO_SIDE_PANEL_PAGE_INFO') {
|
|
pageInfo.value = message.data
|
|
pageInfo.value = message.data
|
|
@@ -307,14 +290,14 @@ onMounted(async () => {
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
|
|
|
+<style lang="scss" scoped>
|
|
.chat-container {
|
|
.chat-container {
|
|
height: 100vh;
|
|
height: 100vh;
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
border: 1px solid #dcdfe6;
|
|
border: 1px solid #dcdfe6;
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
- background-color: #fff;
|
|
|
|
|
|
+ background-color: #F0F0F0;
|
|
font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
|
|
font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -428,55 +411,10 @@ onMounted(async () => {
|
|
color: #409eff;
|
|
color: #409eff;
|
|
}
|
|
}
|
|
|
|
|
|
-.input-area {
|
|
|
|
- padding: 16px;
|
|
|
|
- color: #7F838A;
|
|
|
|
- border-top: 1px solid #eaeaea;
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: space-between;
|
|
|
|
- align-items: center;
|
|
|
|
- gap: 12px;
|
|
|
|
- background-color: #f9f9f9;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-.input-area :deep(.el-textarea__inner) {
|
|
|
|
- border-radius: 8px;
|
|
|
|
- transition: border-color 0.3s;
|
|
|
|
- resize: none;
|
|
|
|
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-.input-area :deep(.el-textarea__inner:focus) {
|
|
|
|
- border-color: #409eff;
|
|
|
|
- box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
.info-card {
|
|
.info-card {
|
|
margin: 10px;
|
|
margin: 10px;
|
|
}
|
|
}
|
|
|
|
|
|
-.card-content {
|
|
|
|
- display: flex;
|
|
|
|
- align-items: center;
|
|
|
|
- gap: 12px;
|
|
|
|
- padding: 14px 12px;
|
|
|
|
- margin: 0 12px 6px;
|
|
|
|
- background: #fff;
|
|
|
|
- border-radius: 10px;
|
|
|
|
- border: 1px solid rgba(0, 0, 0, 0.08);
|
|
|
|
- font-size: 14px;
|
|
|
|
- /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
|
|
- transition: transform 0.2s, box-shadow 0.2s; */
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-.card-btn {
|
|
|
|
- padding: 0 12px 4px;
|
|
|
|
-
|
|
|
|
- .op {
|
|
|
|
- margin-right: 3px;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/* .card-content:hover {
|
|
/* .card-content:hover {
|
|
transform: translateY(-2px);
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
|
|
@@ -574,4 +512,63 @@ onMounted(async () => {
|
|
opacity: 1;
|
|
opacity: 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+.input-area {
|
|
|
|
+ padding: 8px 10px;
|
|
|
|
+ color: black;
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ border: 1px solid rgba(102, 102, 102, 0.3);
|
|
|
|
+ border-radius: 16px;
|
|
|
|
+ margin: 0 12px 12px;
|
|
|
|
+
|
|
|
|
+ .card-content {
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ gap: 12px;
|
|
|
|
+ padding: 14px 12px;
|
|
|
|
+ margin: 0 0 6px;
|
|
|
|
+ background: #fff;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ border: 1px solid rgba(0, 0, 0, 0.08);
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);*/
|
|
|
|
+ transition: transform 0.4s;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .card-btn {
|
|
|
|
+ padding: 0 0 4px;
|
|
|
|
+
|
|
|
|
+ .op {
|
|
|
|
+ margin-right: 3px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .chat_area_op {
|
|
|
|
+ margin-top: 3px;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: end;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area:hover {
|
|
|
|
+ border-color: rgba(102, 102, 102, 0.4);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area :deep(.el-textarea__inner) {
|
|
|
|
+ border-radius: 8px;
|
|
|
|
+ transition: border-color 0.3s;
|
|
|
|
+ resize: none;
|
|
|
|
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area :deep(.el-textarea__inner) {
|
|
|
|
+ padding: 0 4px;
|
|
|
|
+ margin-top: 3px;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.input-area :deep(.el-textarea__inner:focus) {
|
|
|
|
+ border-color: #409eff;
|
|
|
|
+ box-shadow: none;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|