|
@@ -26,7 +26,12 @@
|
|
|
:finish="message.finish"
|
|
|
:steps="message.steps"
|
|
|
/>
|
|
|
-
|
|
|
+ <StepsRun
|
|
|
+ v-if="message.type === 'run'"
|
|
|
+ :content="message.content"
|
|
|
+ :finish="message.finish"
|
|
|
+ :steps="message.steps"
|
|
|
+ />
|
|
|
<span v-else v-html="message.content"></span>
|
|
|
<span class="loading-indicator" v-if="sendLoading && index === messages.length - 1">
|
|
|
<span class="dot"></span>
|
|
@@ -130,6 +135,7 @@ import { useMsg } from '@/entrypoints/sidepanel/hook/useMsg.ts'
|
|
|
import document from '@/entrypoints/sidepanel/component/document.vue'
|
|
|
import ScrollToBottom from '@/entrypoints/sidepanel/component/ScrollToBottom.vue'
|
|
|
import StepsDisplay from './component/StepsDisplay.vue'
|
|
|
+import StepsRun from './component/StepsRun.vue'
|
|
|
import userAvatar from '@/assets/images/user.png'
|
|
|
import avatar from '@/public/icon/icon.png'
|
|
|
import { FunctionList } from '@/entrypoints/sidepanel/mock'
|
|
@@ -310,6 +316,7 @@ async function handleAsk(value) {
|
|
|
createWS(msg)
|
|
|
}
|
|
|
let planMsg
|
|
|
+let runMsg
|
|
|
/**
|
|
|
*
|
|
|
* @param msg 用户消息对象,调用askQues时需要
|
|
@@ -320,7 +327,7 @@ async function createWS(msg) {
|
|
|
type: '',
|
|
|
rawContent: '',
|
|
|
senderId: -1,
|
|
|
- receiverId: userStore.userInfo.id, //大模型
|
|
|
+ receiverId: userStore.userInfo.id,
|
|
|
content: [],
|
|
|
sortKey: moment().valueOf(),
|
|
|
role: 'system',
|
|
@@ -349,13 +356,30 @@ async function createWS(msg) {
|
|
|
nextTick(() => {
|
|
|
if (scrollbar.value && scrollbar.value.wrapRef) {
|
|
|
scrollbar.value.setScrollTop(scrollbar.value.wrapRef.scrollHeight)
|
|
|
- }
|
|
|
+ }
|
|
|
+ const obj = runMsg = reactive({
|
|
|
+ type: 'run',
|
|
|
+ rawContent: '',
|
|
|
+ senderId: -1,
|
|
|
+ receiverId: userStore.userInfo.id,
|
|
|
+ content: [],
|
|
|
+ sortKey: moment().valueOf(),
|
|
|
+ role: 'system',
|
|
|
+ conversationId: msgUuid.value
|
|
|
+ })
|
|
|
+ messages.value.push(obj)
|
|
|
+ // runMsg.content.push(message.payload)
|
|
|
+ nextTick(() => {
|
|
|
+ if (scrollbar.value && scrollbar.value.wrapRef) {
|
|
|
+ scrollbar.value.setScrollTop(scrollbar.value.wrapRef.scrollHeight)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
chrome.runtime.sendMessage({
|
|
|
type: "FROM_PLAN",
|
|
|
payload: {params,...res.data.plan},}, function (response) {
|
|
|
console.log(response, 123344);
|
|
|
- planMsg.finish = response.status
|
|
|
+ runMsg.finish = response.status
|
|
|
});
|
|
|
}).catch(res => {
|
|
|
obj.rawContent = '接口出错,请重试。'
|
|
@@ -372,12 +396,12 @@ onMounted(async () => {
|
|
|
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
|
if (message.type == 'FROM_STEP') {
|
|
|
console.log(message);
|
|
|
- planMsg.content.push(message.payload)
|
|
|
+ runMsg.content.push(message.payload)
|
|
|
nextTick(() => {
|
|
|
- if (scrollbar.value && scrollbar.value.wrapRef) {
|
|
|
- scrollbar.value.setScrollTop(scrollbar.value.wrapRef.scrollHeight)
|
|
|
- }
|
|
|
- })
|
|
|
+ if (scrollbar.value && scrollbar.value.wrapRef) {
|
|
|
+ scrollbar.value.setScrollTop(scrollbar.value.wrapRef.scrollHeight)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
if (message.type === 'TO_SIDE_PANEL_PAGE_INFO') {
|
|
|
pageInfo.value = message.data
|