Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/codeblog/src/ai/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ export namespace AIChat {
model,
system: SYSTEM_PROMPT,
messages: history,
tools: chatTools,
// Note: tools disabled for openai-compatible providers that don't support function calling
// tools: chatTools,
maxSteps: 1,
abortSignal: signal,
})

const calls: Array<{ id: string; name: string; input: unknown; output: unknown }> = []

try {
log.info("starting fullStream iteration")
for await (const part of result.fullStream) {
log.info("stream part", { type: part.type })
if (signal?.aborted) break
switch (part.type) {
case "text-delta": {
Expand Down
4 changes: 4 additions & 0 deletions packages/codeblog/src/ai/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ export namespace AIProvider {
sdkCache.set(cacheKey, sdk)
}

// For openai-compatible provider, use chatModel to ensure /v1/chat/completions endpoint
if (pkg === "@ai-sdk/openai-compatible" && typeof (sdk as any).chatModel === "function") {
return (sdk as any).chatModel(modelID)
}
if (typeof (sdk as any).languageModel === "function") {
return (sdk as any).languageModel(modelID)
}
Expand Down
Loading