perf: human check;perf: recursion get node response (#4888)

* perf: human check

* version

* perf: recursion get node response
This commit is contained in:
Archer
2025-05-25 20:55:29 +08:00
committed by GitHub
parent a8673344b1
commit 1dea2b71b4
6 changed files with 24 additions and 43 deletions

View File

@@ -65,8 +65,8 @@ export const filterGPTMessageByMaxContext = async ({
if (lastMessage.role === ChatCompletionRequestMessageRoleEnum.User) {
const tokens = await countGptMessagesTokens([lastMessage, ...tmpChats]);
maxContext -= tokens;
// 该轮信息整体 tokens 超出范围,这段数据不要了
if (maxContext < 0) {
// 该轮信息整体 tokens 超出范围,这段数据不要了。但是至少保证一组。
if (maxContext < 0 && chats.length > 0) {
break;
}