Repository navigation
fix(feishu): 卡片剔除 markdown 图片,4xx 拒收不再重试 - #153
Merged
Merged
Conversation
turn/end 的最终回答里带  时,飞书把路径当成 img_key,整张卡片被 400/200570 拒收。现在 buildBody/buildCard 统一把图片降级为 🖼 alt(截断前先剔除,避免切出半截语法),--text 模式同样清理。isPermanentFeishuError 把 4xx(408/429 除外)判为永久失败,确定性错误不再白重试。
Merged
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.
问题
turn/end通知把最终回答原样放进飞书卡片;回答里的会被飞书当作img_key解析,而卡片图片只能用im/v1/images上传换来的 key,于是整张卡片被拒收:实测于会话「审查Web端后端并修复推送」:本地图表
yixin-ai/.dsh-tmp/api-key-trend-desktop.png被写进回答,通知失败且retries会重试一个确定性错误。改动
examples/notify-feishu.mjs:新增stripCardImages(),把/![alt][ref]降级为🖼 alt;buildBody在截断前剔除,buildCard对最终卡片正文兜底,--text模式同样清理。src/feishu-notify.ts:isPermanentFeishuError解析飞书接口 HTTP <status>,4xx(408/429 除外)判永久失败;5xx/传输失败仍重试。examples/notify-feishu.d.mts补声明;两份 README 同步说明;lib/随构建更新。stripCardImages用例 + 2 条 buildBody/buildCard 用例 + 2 条重试分类用例。验证
tsc(主 / client / test)全绿;vitest run548/548 通过;tsc + tsdown构建通过。run(),发出的卡片正文为… 🖼 桌面端 API Key 用量趋势图 …,不再含![](。