Repository navigation
fix: 百炼兼容网关 max_tokens 超限导致请求被拒 - #21
Open
xuyixiao0224 wants to merge 1 commit into
Open
xuyixiao0224 wants to merge 1 commit into
xuyixiao0224 wants to merge 1 commit into
Conversation
百炼(DashScope)OpenAI 兼容网关要求 max_tokens 在 [1, 131072], 而未识别的 base_url 一律使用 _PRACTICAL_UNLIMITED_MAX_TOKENS,超出上限。 按现有 Packy Claude / DeepSeek 原生的写法补一条百炼上限判断, 通过 base_url 含 aliyuncs.com 或 dashscope 识别,公共端点与专属部署均覆盖。 其他提供方行为不变。
wujiaxiang
added a commit
to wujiaxiang/PA_Agent
that referenced
this pull request
Oct 4, 2026
用 Playwright 实机截图排查后发现的 4 个问题(均已修复并回归验证)。
1. [High] 追问输入框完全落在视口之外
.chat-input-row 位于 #tab-stream 滚动流末尾,1000px 视口下
getBoundingClientRect().top = 1011,用户必须滚动才能追问,
而「分析完成后继续追问」是本应用的主交互之一。
免责声明同样被折线切成一半(top 982 / bottom 1011 > vh 1000)。
修复:把免责声明 + 输入框包进 .stream-footer 并整体 sticky 到底部
(JS 不依赖二者的兄弟关系,app.js 仅按 #chat-input 等 id 取元素)。
2. [Med] MACD 副图从未被启用
initIndicators() 注释写「默认启用 6 条 EMA + MACD 副图」,但循环里
只 addIndicator('ema', ...) 六次,addIndicator('macd') 调用数为 0。
导致 #chart-osc-wrap 永远 display:none / 高度 0,副图功能形同虚设。
修复:补 addIndicator('macd', {})。实测 osc-wrap 变为 flex / 140px,
MACD(12,26,9) 柱状图与 DIF/DEA 正常绘制。
3. [Med] 主图 6 条 EMA 全无标识
首屏默认叠加 EMA5/10/20/40/60/120,但没有任何图例,用户无法区分
紫=EMA5 与橙=EMA10。新增 #chart-legend:读取各 overlay series 的
**实际 applyOptions 颜色**渲染(因此 EMA20/40/60/120 的加粗配色与
用户自定义指标都能如实反映),点击可临时隐藏单条线便于观察。
像素级回归:点击 EMA5 → #b26cff 像素 518 → 0,再点恢复 → 518。
4. [Med] 序号标记在长序列下淹没 K 线
_seqStep 按固定档位取 step,200 根落在 step=5 → 屏幕上铺 40 个 #N
圆点+文本,蜡烛完全被遮盖。改为「标记总数上限 16 + 整数步长表
[1,2,5,10,20,25,50,100]」:任意长度下标记数 ≤16,且序号取整
(#1/rosemarycox5334-debug#21/#41…)。200 根从 40 个降到 10 个。
版本号(AGENTS.md 硬约束):chart.js v4→5、indicators.js v3→4、
style.css v18→19→20、app.js v27→28→29。
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.
适配说明
本 PR 是基于较早 main 基线生成的 patch,重新适配到当前最新 main(上游在此期间重构了 deepseek_client.py:新增了 _is_sensenova / _is_bai 等网关识别,_provider_max_output_tokens 改为 cap = ... + elif 链式结构)。
改动意图与原 patch 完全一致——补一条百炼 / DashScope 网关的 max_tokens 上限判断,只是位置移到新结构对应处(_is_bailian() 函数加在 _is_bai 之后,常量加在 _BAI_MAX_OUTPUT_TOKENS 之后,分支加在 _is_deepseek_native 与 _is_sensenova 之间)。
闂
閰嶇疆闃块噷浜戠櫨鐐硷紙DashScope锛夌殑 OpenAI 鍏煎缃戝叧浣滀负 AI 鎻愪緵鏂规椂锛岃姹備細琚綉鍏虫嫆缁濄€?
鐧剧偧鍏煎缃戝叧瑕佹眰
max_tokens钀藉湪[1, 131072]锛屼絾_provider_max_output_tokens()瀵规湭璇嗗埆鐨?base_url 涓€寰嬭繑鍥?_PRACTICAL_UNLIMITED_MAX_TOKENS锛岃秴鍑轰笂闄愶紝缃戝叧鐩存帴鎶ラ敊銆?鏀瑰姩
鎸夌幇鏈夊啓娉曡ˉ涓€鏉$櫨鐐肩殑涓婇檺锛屼笌宸叉湁鐨?Packy Claude锛?28000锛夈€丏eepSeek 鍘熺敓锛?93216锛変袱鏉″垽鏂悓鏋勶細
_BAILIAN_MAX_OUTPUT_TOKENS = 131_072_is_bailian()锛岄€氳繃 base_url 鍚?aliyuncs.com鎴?dashscope璇嗗埆_provider_max_output_tokens()涓姞鍏ュ搴斿垎鏀?褰卞搷闈?
鍙奖鍝?base_url 鎸囧悜鐧剧偧/DashScope 鐨勯厤缃€傚叾浠栨彁渚涙柟璧扮殑鍒嗘敮鍜屽彇鍊煎畬鍏ㄤ笉鍙橈紝鏃犺涓哄彉鍖栥€?
娴嬭瘯
pytest -m "not e2e"ruff check pa_agent testsmax_tokens瓒呴檺閿欒澶囨敞
鐧剧偧鏈夊叕鍏辩鐐瑰拰涓撳睘閮ㄧ讲涓ょ褰㈡€侊紝涓撳睘閮ㄧ讲鐨勫煙鍚嶅舰濡?
<workspace>.<region>.maas.aliyuncs.com锛屼袱鑰呴兘鑳借aliyuncs.com鍖归厤鍒般€?