model catalog
This commit is contained in:
@@ -83,6 +83,18 @@ export type CompletionRequestMessage = {
|
||||
name?: string;
|
||||
};
|
||||
|
||||
export type Provider = "openai" | "anthropic" | "xai";
|
||||
|
||||
export type ProviderModelInfo = {
|
||||
models: string[];
|
||||
loadedAt: string | null;
|
||||
error: string | null;
|
||||
};
|
||||
|
||||
export type ModelCatalogResponse = {
|
||||
providers: Record<Provider, ProviderModelInfo>;
|
||||
};
|
||||
|
||||
type CompletionResponse = {
|
||||
chatId: string | null;
|
||||
message: {
|
||||
@@ -142,6 +154,10 @@ export async function verifySession() {
|
||||
return api<{ authenticated: true; mode: "open" | "token" }>("/v1/auth/session");
|
||||
}
|
||||
|
||||
export async function listModels() {
|
||||
return api<ModelCatalogResponse>("/v1/models");
|
||||
}
|
||||
|
||||
export async function createChat(title?: string) {
|
||||
const data = await api<{ chat: ChatSummary }>("/v1/chats", {
|
||||
method: "POST",
|
||||
@@ -296,7 +312,7 @@ export async function runSearchStream(
|
||||
|
||||
export async function runCompletion(body: {
|
||||
chatId: string;
|
||||
provider: "openai" | "anthropic" | "xai";
|
||||
provider: Provider;
|
||||
model: string;
|
||||
messages: CompletionRequestMessage[];
|
||||
}) {
|
||||
|
||||
Reference in New Issue
Block a user