From 5e0c2531a2179632ebe0cfff79910960f70b426f Mon Sep 17 00:00:00 2001 From: shadowcz007 Date: Mon, 12 Jun 2023 00:04:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ChatbotMain.tsx | 7 +++++-- src/components/background/Common.js | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/ChatbotMain.tsx b/src/components/ChatbotMain.tsx index af0b89b..2a79b32 100644 --- a/src/components/ChatbotMain.tsx +++ b/src/components/ChatbotMain.tsx @@ -264,6 +264,7 @@ const sendMessageToBackground = { 'api-run': (data: any) => sendMessageCanRetry('api-run', data, console.log), 'open-options-page': (data: any) => sendMessageCanRetry('open-options-page', data, console.log), 'hi': (data: any) => sendMessageCanRetry('hi', data, console.log), + } @@ -589,7 +590,8 @@ class Main extends React.Component<{ }) } else if (cmd == 'chat-bot-init-result') { this.initChatBot(false); - } + } + sendResponse('我是content,已收到消息') return true; @@ -1376,7 +1378,7 @@ class Main extends React.Component<{ promptJson = { ...promptJson, ...await promptBindUserClipboard(promptJson.userInput) } } else if (prompt.input == 'nodeInput') { // 从上一节点获取文本,prompt的输入从上一个节点输入 - console.log('从上一节点获取文本', prompt, prompt.nodeInputId, nTalks) + console.log('从上一节点获取文本', prompt.nodeInputId, nTalks) if (!prompt.nodeInputId) { let lastTalk: any = Talks.getLastTalk([...nTalks]); promptJson = { ...promptJson, ...promptUseLastTalk(promptJson.userInput, lastTalk) } @@ -1384,6 +1386,7 @@ class Main extends React.Component<{ let talk: any = Talks.getTalkByPromptId(prompt.nodeInputId, [...nTalks]); promptJson = { ...promptJson, ...promptUseLastTalk(promptJson.userInput, talk) } } + console.log('从上一节点获取文本', prompt.nodeInputId, promptJson.context) } // translate的处理 diff --git a/src/components/background/Common.js b/src/components/background/Common.js index fdc5be7..a475257 100644 --- a/src/components/background/Common.js +++ b/src/components/background/Common.js @@ -15,6 +15,8 @@ */ +import { fetchImage } from '../Utils' + class Common { constructor(json, chatBot, Agent, Credit) { @@ -275,7 +277,7 @@ class Common { Credit.getPoints(token, apiName).then(res => { chrome.storage.sync.set({ myPoints: res }) }) - } + }; sendResponse('我是后台,已收到消息:' + JSON.stringify(request)) return true }