mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-24 06:33:01 -04:00
chore: generate
This commit is contained in:
@@ -28,12 +28,7 @@ import {
|
||||
GoUsageLimitError,
|
||||
BlackUsageLimitError,
|
||||
} from "./error"
|
||||
import {
|
||||
buildCostChunk,
|
||||
createStreamPartConverter,
|
||||
createResponseConverter,
|
||||
UsageInfo,
|
||||
} from "./provider/provider"
|
||||
import { buildCostChunk, createStreamPartConverter, createResponseConverter, UsageInfo } from "./provider/provider"
|
||||
import { anthropicHelper } from "./provider/anthropic"
|
||||
import { googleHelper } from "./provider/google"
|
||||
import { openaiHelper } from "./provider/openai"
|
||||
@@ -97,8 +92,7 @@ export async function handler(
|
||||
const body = input.request.body
|
||||
if (!body) throw new Error("Missing request body")
|
||||
requestBody = opts.format === "google" ? undefined : await prepareRequestBody(body)
|
||||
const model =
|
||||
opts.format === "google" ? opts.parseModel(url, undefined) : (requestBody?.model ?? "")
|
||||
const model = opts.format === "google" ? opts.parseModel(url, undefined) : (requestBody?.model ?? "")
|
||||
const googleStream = opts.format === "google" ? opts.parseIsStream(url, undefined) : undefined
|
||||
const rawIp = input.request.headers.get("x-real-ip") ?? ""
|
||||
const ip = rawIp.includes(":") ? rawIp.split(":").slice(0, 4).join(":") : rawIp
|
||||
@@ -201,7 +195,8 @@ export async function handler(
|
||||
providerInfo.model.startsWith("global.anthropic.") ||
|
||||
providerInfo.model.startsWith("databricks-claude-"))
|
||||
if (providerInfo.format !== opts.format) throw new Error("Zen provider format must match request format")
|
||||
if (providerInfo.payloadModifier) throw new Error("Zen provider payload modifiers are incompatible with streaming")
|
||||
if (providerInfo.payloadModifier)
|
||||
throw new Error("Zen provider payload modifiers are incompatible with streaming")
|
||||
if (specialAnthropic) throw new Error("Anthropic provider body modifiers are incompatible with streaming")
|
||||
const prepared = requestBody
|
||||
|
||||
|
||||
@@ -89,11 +89,7 @@ function replace(chunks: Uint8Array[], start: number, end: number, value: string
|
||||
})
|
||||
}
|
||||
|
||||
function passthrough(
|
||||
initial: Uint8Array[],
|
||||
reader: ReadableStreamDefaultReader<Uint8Array>,
|
||||
sourceDone: boolean,
|
||||
) {
|
||||
function passthrough(initial: Uint8Array[], reader: ReadableStreamDefaultReader<Uint8Array>, sourceDone: boolean) {
|
||||
let done = sourceDone
|
||||
return new ReadableStream<Uint8Array>({
|
||||
async pull(controller) {
|
||||
|
||||
Reference in New Issue
Block a user