Skip to content

同样是200消息.可否增加自定义函数过滤处理,然后返回处理结果. #750

@s6yoho

Description

@s6yoho
Image

响应头

UPSTREAM: HTTP 200 https://ai.hybgzs.com/claude/v1/messages?beta=true

alt-svc: h3=":443"; ma=86400
cache-control: no-cache, no-cache
cf-cache-status: DYNAMIC
cf-ray: 9cb803951e1f33ad-LAX
connection: keep-alive
content-type: text/event-stream
date: Tue, 10 Feb 2026 02:00:39 GMT
expect-ct: max-age=86400, enforce
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
referrer-policy: same-origin
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=7OFOxtAzpQysLTbaMWBu%2B6jVbgdVvairXBrFFTewDHQ40C1UF29cfKy48gZR4qEOS4EAYd%2FOmpTdKjJDsC%2FpQRHUZ8fG0yrwakChCr0%3D"}]}
server: cloudflare
set-cookie: serv******th=/
transfer-encoding: chunked
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-oneapi-request-id: 20260210100038120065382BLdxI5EY
x-xss-protection: 1; mode=block

响应

event: message_start
data: {"type": "message_start", "message": {"id": "msg_6dc3032704af417f9419eb3b", "type": "message", "role": "assistant", "content": [], "model": "claude-opus-4-6-20260206", "stop_reason": null, "stop_sequence": null, "usage": {"input_tokens": 0, "output_tokens": 0}}}

event: content_block_start
data: {"type": "content_block_start", "index": 0, "content_block": {"type": "text", "text": ""}}

event: content_block_delta
data: {"type": "content_block_delta", "index": 0, "delta": {"type": "text_delta", "text": "\n\n错误: 错误: 429 {\"message\":\"I am experiencing high traffic, please try again shortly.\",\"reason\":\"INSUFFICIENT_MODEL_CAPACITY\"}"}}

event: content_block_stop
data: {"type": "content_block_stop", "index": 0}

event: message_delta
data: {"type": "message_delta", "delta": {"stop_reason": "end_turn", "stop_sequence": null}, "usage": {"input_tokens": 0, "output_tokens": 0}}

event: message_stop
data: {"type": "message_stop"}



不太了解cch的实现机制,但是是否可以添加一个功能,
可以让用户添加一个自定义函数之类的,接受请求与响应,返回 通过, 熔断,临时熔断 , 切换供应商, 重试.
然后用户可以自己根据请求与响应, 改变结果处理.

感觉这种方式就是是侵入性最低的,而且可定制能力更强.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions