Skip to content

Commit 628102a

Browse files
committed
zen: handle alibaba format
1 parent ad7ae73 commit 628102a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • packages/console/app/src/routes/zen/util/provider

packages/console/app/src/routes/zen/util/provider/anthropic.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,13 @@ export const anthropicHelper: ProviderHelper = ({ reqModel, providerModel }) =>
148148
return {
149149
parse: (chunk: string) => {
150150
const data = chunk.split("\n")[1]
151-
if (!data.startsWith("data: ")) return
151+
// Claude models start with "data: {"
152+
// Alibaba models start with "data:{"
153+
if (!data.startsWith("data:")) return
152154

153155
let json
154156
try {
155-
json = JSON.parse(data.slice(6))
157+
json = JSON.parse(data.replace(/^data:\s*/, ""))
156158
} catch {
157159
return
158160
}

0 commit comments

Comments
 (0)