Repository navigation
fix: 模型输出被截断时不再标记为转换成功 (#87) - #90
Merged
Merged
Conversation
A page cut off by the output token limit was marked as converted, so the user got incomplete Markdown with nothing in the UI to show it. Ollama always reported `stop`, and ConverterWorker never read finishReason. - Report truncation with one value, FINISH_REASON_TRUNCATED, from all five clients (length / max_tokens / MAX_TOKENS / max_output_tokens). Other reasons pass through as before. - Read the reason the Responses API really uses, incomplete_details.reason, including the response.incomplete stream event. - ConverterWorker treats truncation as a retryable failure, so the reason reaches the existing page and task error display. - Clients don't throw on truncation, so the connection test with maxTokens: 8 keeps working.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #87
改动
LLMClient基类里统一映射截断原因(length/max_tokens/MAX_TOKENS等统一为FINISH_REASON_TRUNCATED);五类客户端(OpenAI、Anthropic、Gemini、Ollama、OpenAI Responses)都改为读取真实的结束原因,不再写死stopdone_reason;Responses 客户端读取incomplete_details.reason,流式处理response.incompleteConverterWorker检测到截断时抛错,走现有的重试和失败流程:页面标记为 FAILED 并写入错误原因,部分内容不保存maxTokens: 8)不受影响测试
FinishReason.test.ts(五类客户端,流式和非流式)、ConverterWorker.test.ts、completion.handler.test.tsnpm run test:unit:50 个文件,1069 个用例全部通过npm run typecheck、eslint:通过done_reason读取后,都有对应测试失败行为变化
未验证项