diff --git "a/examples/combo/test-\347\224\250\346\210\267\350\276\223\345\205\245-\346\226\207\346\241\210_DG-E7g-s_AMnSkk0W-nHe.json" "b/examples/combo/test-\347\224\250\346\210\267\350\276\223\345\205\245-\346\226\207\346\241\210_DG-E7g-s_AMnSkk0W-nHe.json" new file mode 100644 index 0000000..bf34ae8 --- /dev/null +++ "b/examples/combo/test-\347\224\250\346\210\267\350\276\223\345\205\245-\346\226\207\346\241\210_DG-E7g-s_AMnSkk0W-nHe.json" @@ -0,0 +1 @@ +[{"tag":"test-用户输入-文案","role":{"name":"","text":"你是一位古诗词高手,会写诗"},"combo":2,"interfaces":["showInChat"],"isInfinite":false,"owner":"user","prompt":{"id":"USERINPUTTEXT_NVZIEYQ3H-TUWY0DRF9QM","type":"userInputText","inputs":{"nodes":[],"output":""},"userInput":"请输入性别","role":{"name":"","text":"你是一位古诗词高手,会写诗"}},"version":"0.3.0","app":"brainwave","id":"DG-E7g-s_AMnSkk0W-nHe","createDate":1688373247275,"prompt2":{"id":"PROMPT_BFCEJTGXUMV74I8TJCMQR","nextId":"","nodeInputId":"USERINPUTTEXT_NVZIEYQ3H-TUWY0DRF9QM","role":{"name":"","text":"你是一位古诗词高手,会写诗"},"text":"结合```${context}``` 写一个古诗词,并写成笑话","url":"","temperature":0.84,"model":"ChatGPT","input":"nodeInput","userInput":"","translate":"default","output":"default","type":"prompt","merged":null}}] \ No newline at end of file diff --git "a/examples/combo/\350\276\223\345\205\245\347\275\221\347\253\231\345\220\216\350\267\263\350\275\254_3T2K8wncaKIuerL5rAxpW.json" "b/examples/combo/\350\276\223\345\205\245\347\275\221\347\253\231\345\220\216\350\267\263\350\275\254_3T2K8wncaKIuerL5rAxpW.json" new file mode 100644 index 0000000..23405c7 --- /dev/null +++ "b/examples/combo/\350\276\223\345\205\245\347\275\221\347\253\231\345\220\216\350\267\263\350\275\254_3T2K8wncaKIuerL5rAxpW.json" @@ -0,0 +1 @@ +[{"tag":"输入网站后跳转","role":{"merged":[],"name":"","text":""},"combo":2,"interfaces":[],"isInfinite":false,"owner":"user","prompt":{"id":"USERINPUTTEXT_TF0RFB9YPR7HCZMCNWM8C","type":"userInputText","inputs":{"nodes":[],"output":""},"userInput":"请输入网站","role":{"merged":[],"name":"","text":""}},"version":"0.3.0","app":"brainwave","id":"3T2K8wncaKIuerL5rAxpW","createDate":1688374214203,"prompt2":{"id":"QUERYDEFAULT_D0WFIAV6LLXCNRRPLURWI","nextId":"","nodeInputId":"USERINPUTTEXT_TF0RFB9YPR7HCZMCNWM8C","role":{"merged":[],"name":"","text":""},"url":"","queryObj":{"action":"default","content":"bindCurrentPage","delay":1000,"protocol":"https://","query":"","url":"${context}"},"input":"nodeInput","userInput":"","type":"queryDefault"}}] \ No newline at end of file diff --git a/package.json b/package.json index f47780c..dcc5812 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Earth", "displayName": "Earth", - "version": "0.3.7.5", + "version": "0.3.8.0", "description": "AGIUI for Browser Extension", "license": "MIT", "repository": { diff --git a/src/components/ChatbotMain.tsx b/src/components/ChatbotMain.tsx index e526d4f..4a14504 100644 --- a/src/components/ChatbotMain.tsx +++ b/src/components/ChatbotMain.tsx @@ -881,9 +881,9 @@ class Main extends React.Component<{ }) } - _queryDefaultRun(queryObj: any, combo: any) { - - QueryDefaultRun(queryObj, combo).then((res: any) => { + _queryDefaultRun(prompt: any, combo: any) { + const { queryObj, context } = prompt; + QueryDefaultRun(queryObj, context, combo).then((res: any) => { this.updateChatBotStatus(false); @@ -1420,7 +1420,7 @@ class Main extends React.Component<{ // 清空type thinking 的状态 nTalks = Talks.filter(nTalks) nTalks.push(ChatBotConfig.createTalkData('ask-user-input', { - html: "请输入" + html: prompt.userInput || i18n.t('inputTitle') })); this._userInputTextRun() } @@ -1565,15 +1565,26 @@ class Main extends React.Component<{ if (this.state.chatBotStyle && this.state.chatBotStyle.value) promptJson.temperature = this.state.chatBotStyle.value; } - // role 给调试用 + if ([ 'prompt', - 'promptCustom', + 'promptCustom' + ].includes(promptJson.type)) { + + if (!promptJson.model) promptJson.model = this.state.chatBotType; + if (!promptJson.temperature && this.state.chatBotStyle && this.state.chatBotStyle.value) promptJson.temperature = this.state.chatBotStyle.value; + + this._llmRun(promptJson, newTalk); + + }; + + // role 给调试用 + if ([ 'role', ].includes(promptJson.type)) { - if (!promptJson.prompt.model) promptJson.prompt.model = this.state.chatBotType; - if (!promptJson.prompt.temperature && this.state.chatBotStyle && this.state.chatBotStyle.value) promptJson.prompt.temperature = this.state.chatBotStyle.value; + promptJson.model = this.state.chatBotType; + if (this.state.chatBotStyle && this.state.chatBotStyle.value) promptJson.temperature = this.state.chatBotStyle.value; this._llmRun(promptJson, newTalk); @@ -1591,7 +1602,7 @@ class Main extends React.Component<{ }; // queryDefault 跳转页面 - if (promptJson.type === 'queryDefault') this._queryDefaultRun(promptJson.queryObj, currentCombo); + if (promptJson.type === 'queryDefault') this._queryDefaultRun(promptJson, currentCombo); // queryRead 读取 if (promptJson.type == "queryRead") this._queryReadRun(promptJson.queryObj); diff --git a/src/components/background/Common.js b/src/components/background/Common.js index df67bd9..d80f918 100644 --- a/src/components/background/Common.js +++ b/src/components/background/Common.js @@ -232,7 +232,8 @@ class Common { Agent.executeScript(data.url, { query: data.query, text: data.text, - type: data.type + type: data.type, + delay: data.delay, //修复delay漏传的bug }, data.combo) } else if (cmd == "api-run") { const { url, init, combo, promptId } = data; diff --git a/src/components/flow/Sidebar/index.tsx b/src/components/flow/Sidebar/index.tsx index b0cd72e..63ec643 100644 --- a/src/components/flow/Sidebar/index.tsx +++ b/src/components/flow/Sidebar/index.tsx @@ -30,7 +30,7 @@ export default (props: any) => { onChange={onChange} style={{ width: 180, userSelect: 'none', - background: 'white' + background: 'white', }}>

{i18n.t('component')}

{ @@ -39,8 +39,9 @@ export default (props: any) => {