Compare commits

..

No commits in common. "74359067d0e31c7a5ad80a72f01a219407e33ca7" and "02a5b0f7b97cc71e61f7fd811ec652a4995315cf" have entirely different histories.

4 changed files with 2 additions and 21 deletions

View file

@ -17,4 +17,3 @@ RUN npx tsc
# Run the app # Run the app
CMD ["node", "dist/src/index.js"] CMD ["node", "dist/src/index.js"]
STOPSIGNAL SIGINT

View file

@ -246,7 +246,7 @@ async function executeFromQueue(channel: string) {
...config.chatCompletionParams, ...config.chatCompletionParams,
messages: OpenAImessages, messages: OpenAImessages,
// FIXME: don't use new instance of FunctionManager // FIXME: don't use new instance of FunctionManager
functions: new FunctionManager().getFunctionsForOpenAi(), functions: new FunctionManager().getFunctions(),
}); });
logUsedTokens(answer, message, ++functionRanCounter); logUsedTokens(answer, message, ++functionRanCounter);

View file

@ -62,11 +62,6 @@ export default class FunctionManager {
return rvalue; return rvalue;
} }
public getFunctionsForOpenAi(): ChatCompletionFunctions[] | undefined {
const rvalue = this.getFunctions();
return rvalue.length > 0 ? rvalue : undefined;
}
public handleFunction(request: ChatCompletionFunctionCall): ChatCompletionMessageParam { public handleFunction(request: ChatCompletionFunctionCall): ChatCompletionMessageParam {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
let parsedArguments: any; let parsedArguments: any;

View file

@ -63,17 +63,4 @@ discord.on("messageCreate", message => {
return queueRequest(message); return queueRequest(message);
}); });
if (require.main === module) { if (require.main === module) void discord.login(config.tokens.Discord);
void discord.login(config.tokens.Discord);
process.on("SIGINT", () => {
console.log("got SIGINT, exiting");
//FIXME: finish executing requests then exit
discord.destroy()
.then(() => process.exit())
.catch((e) => {
console.error("Failed to gracefully exit");
console.error(e);
process.exit();
});
});
}