Добавить поддержку Qwen thinking/reasoning#2
Open
johnnykor82 wants to merge 1 commit into
Open
Conversation
Parse Qwen think/answer phases into reasoning_content and content so OpenAI-compatible streaming and non-streaming responses expose both parts separately.
ForgetMeAI
requested changes
Jul 13, 2026
ForgetMeAI
left a comment
Owner
There was a problem hiding this comment.
Идея поддержки reasoning_content полезная, но эту версию пока нельзя безопасно сливать.
Пожалуйста:
- rebase на текущий
mainпосле #4; - не включать thinking молча для всех
t2tи не задавать глобальный default budget81920без явного opt-in/ограничения; - сохранить system/tools/files, account affinity, полный replay при
401/429и запрет retry после частично отправленного SSE; - либо разделить Node/Python на проверяемые PR, либо дать одинаковые fixtures для обеих реализаций;
- добавить тесты границ
think -> answer, malformed/non-SSE transport, tool-call режима, non-stream/stream parity и failover во время каждой фазы.
После этого PR можно будет пересмотреть как изолированную feature без регрессии недавно исправленного retry/security контура.
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.
Привет! Добавил поддержку Qwen thinking/reasoning для текстовых
t2tзапросов в OpenAI-compatible API.Что меняется:
t2tpayload включаетсяfeature_config.thinking_enabled;thinking_budgetс дефолтом81920;enable_thinking: false,thinking_enabled: false,reasoning_effort: "none";thinkиanswerпарсятся отдельно;delta.reasoning_contentиdelta.content;message.reasoning_contentиmessage.content;think-фазы, а ждёт фазу ответа;tools/legacyfunctionsthinking отключается автоматически, чтобы не ломать существующую эмуляциюtool_callsчерез строгий JSON вcontent;main.py;Важно про
tool_calls: текущий Node-прокси не передаёт OpenAI tools в Qwen как нативные schemas, а эмулирует их системным промптом. Поэтому для запросов сtoolsилиfunctionseffectiveenableThinkingпринудительно становитсяfalse, даже если клиент прислалenable_thinking: true.Проверял:
npm test node --check src/api/chat.js node --check src/api/qwenReasoning.js node --check src/api/routes.js python3 -m py_compile main.pyТакже проверял вручную через локальный прокси: non-streaming и streaming ответы корректно разделяют reasoning и финальный answer, а
tool_callsпосле правки продолжают работать.Gist с patch-файлом на случай, если удобнее применить вручную:
https://gist.github.com/johnnykor82/9c92836278a3e5e3cc9853fceda59a41