mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-22 00:00:27 +00:00
Add 'pi' command alias and fix getApiKey import
This commit is contained in:
parent
00d8286523
commit
bf1a7d8571
4 changed files with 284 additions and 8 deletions
|
|
@ -5,6 +5,7 @@ import type {
|
|||
MessageParam,
|
||||
} from "@anthropic-ai/sdk/resources/messages.js";
|
||||
import { calculateCost } from "../models.js";
|
||||
import { getApiKey } from "../stream.js";
|
||||
import type {
|
||||
Api,
|
||||
AssistantMessage,
|
||||
|
|
@ -111,8 +112,8 @@ export const streamAnthropic: StreamFunction<"anthropic-messages"> = (
|
|||
};
|
||||
|
||||
try {
|
||||
const apiKey = options?.apiKey ?? getApiKey(model.provider);
|
||||
const { client, isOAuthToken } = createClient(model, apiKey);
|
||||
const apiKey = options?.apiKey ?? getApiKey(model.provider) ?? "";
|
||||
const { client, isOAuthToken } = createClient(model, apiKey);
|
||||
const params = buildParams(model, context, isOAuthToken, options);
|
||||
const anthropicStream = client.messages.stream({ ...params, stream: true }, { signal: options?.signal });
|
||||
stream.push({ type: "start", partial: output });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue