Skip to content

Commit

Permalink
fixed bug, add function calling display
Browse files Browse the repository at this point in the history
  • Loading branch information
SchneeHertz committed Sep 22, 2023
1 parent 08b6740 commit ecf7a85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,17 @@ const resolveMessages = async ({ resArgument, resFunction, resText, resTextTemp,
messages.push(...functionCalling)
addHistory(functionCalling)
console.log(functionCalling)
messageLogAndSend({
id: nanoid(),
from: 'Function Calling',
text: functionCallResult + ''
})
}
resFunction = ''
resArgument = ''

let prepareChatOption = { messages }

if (round < functionCallingRoundLimit) {
prepareChatOption.functions = functionInfo
prepareChatOption.function_call = 'auto'
Expand Down Expand Up @@ -406,8 +412,8 @@ const resloveAdminPrompt = async ({ prompt, triggerRecord, miraiSystemPrompt })
try {
let round = 0
while (resText === '') {
;({ messages, resArgument, resFunction, resText, resTextTemp, round } = await resolveMessages({
resArgument, resFunction, resText, resTextTemp, messages, from
;({ messages, resArgument, resFunction, resText, resTextTemp } = await resolveMessages({
resArgument, resFunction, resText, resTextTemp, messages, from, round
}))
round += 1
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "chat-xiuliu",
"private": true,
"version": "2.1.5",
"version": "2.1.6",
"description": "ChatGPT Client with Function Calling",
"author": "SchneeHertz",
"scripts": {
Expand Down

0 comments on commit ecf7a85

Please sign in to comment.