Use the request message as always newest in the model history
This may fix #5 but I am not sure
This commit is contained in:
parent
32dd705498
commit
c9f7e3a62e
1 changed files with 6 additions and 1 deletions
|
@ -267,6 +267,7 @@ async function executeFromQueue(channel: string) {
|
||||||
|
|
||||||
messages.forEach(m => { Moderation.checkMessageNoReturn(m); });
|
messages.forEach(m => { Moderation.checkMessageNoReturn(m); });
|
||||||
|
|
||||||
|
const questionMessageId: string = message instanceof DiscordApi.Message ? message.id : '';
|
||||||
if (message instanceof DiscordApi.Message) {
|
if (message instanceof DiscordApi.Message) {
|
||||||
channelQueue.startTyping();
|
channelQueue.startTyping();
|
||||||
}
|
}
|
||||||
|
@ -274,7 +275,11 @@ async function executeFromQueue(channel: string) {
|
||||||
await message.deferReply();
|
await message.deferReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
messages.sort((a, b) => b.createdTimestamp - a.createdTimestamp);
|
messages.sort((a, b) => {
|
||||||
|
if (a.id === questionMessageId) return -1;
|
||||||
|
if (b.id === questionMessageId) return 1;
|
||||||
|
return b.createdTimestamp - a.createdTimestamp;
|
||||||
|
});
|
||||||
|
|
||||||
OpenAImessages = toOpenAIMessages(messages.values());
|
OpenAImessages = toOpenAIMessages(messages.values());
|
||||||
let generatedMessage: ChatCompletionResponseMessage | undefined = undefined;
|
let generatedMessage: ChatCompletionResponseMessage | undefined = undefined;
|
||||||
|
|
Loading…
Reference in a new issue