fix(ci): satisfy provider audit checks
This commit is contained in:
+4
-4
@@ -1,6 +1,5 @@
|
||||
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises"
|
||||
import { dirname } from "node:path"
|
||||
import type { Api } from "@earendil-works/pi-ai"
|
||||
|
||||
export const DEFAULT_PROVIDER_API_BASE = "https://api.commandcode.ai/provider/v1"
|
||||
export const DEFAULT_MODELS_URL = `${DEFAULT_PROVIDER_API_BASE}/models`
|
||||
@@ -9,6 +8,7 @@ export const DEFAULT_MODELS_TIMEOUT_MS = 10_000
|
||||
const DEFAULT_MAX_OUTPUT_TOKENS = 65_536
|
||||
const MODEL_CACHE_VERSION = 1
|
||||
|
||||
export type CommandCodeApi = "openai-completions" | "anthropic-messages"
|
||||
export type CommandCodeInputType = "text" | "image"
|
||||
|
||||
/**
|
||||
@@ -161,17 +161,17 @@ interface ApiModel {
|
||||
export interface CommandCodeModel {
|
||||
id: string
|
||||
name: string
|
||||
api: Api
|
||||
api: CommandCodeApi
|
||||
reasoning: boolean
|
||||
contextWindow: number
|
||||
maxTokens: number
|
||||
}
|
||||
|
||||
export function apiForModelId(id: string): Api {
|
||||
export function apiForModelId(id: string): CommandCodeApi {
|
||||
return id.startsWith("claude-") ? "anthropic-messages" : "openai-completions"
|
||||
}
|
||||
|
||||
export function baseUrlForModel(apiBase: string, api: Api): string {
|
||||
export function baseUrlForModel(apiBase: string, api: CommandCodeApi): string {
|
||||
const normalized = apiBase.replace(/\/+$/g, "")
|
||||
if (api !== "anthropic-messages") return normalized
|
||||
return normalized.endsWith("/v1") ? normalized.slice(0, -3) : normalized
|
||||
|
||||
Reference in New Issue
Block a user