mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-09-17 20:31:47 +02:00
ui : add backend types and constants
Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import type { BackendProtocol } from '$lib/types';
|
||||
|
||||
/** Id of the built-in backend that points at the server serving this UI. */
|
||||
export const LOCAL_BACKEND_ID = 'local';
|
||||
|
||||
/** Protocols a configured backend can speak, in display order. */
|
||||
export const BACKEND_PROTOCOLS: readonly BackendProtocol[] = ['llama.cpp', 'openai', 'anthropic'];
|
||||
|
||||
/** Prefix for generated ids of user-added backends. */
|
||||
export const BACKEND_ID_PREFIX = 'backend';
|
||||
@@ -4,6 +4,7 @@
|
||||
export * from './agentic.constants';
|
||||
export * from './api-endpoints.constants';
|
||||
export * from './app.constants';
|
||||
export * from './backend.constants';
|
||||
export * from './chat-tabs.constants';
|
||||
export * from './database.constants';
|
||||
export * from './reasoning-effort.constants';
|
||||
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Backend types.
|
||||
*
|
||||
* A backend is one API endpoint the UI can talk to. The built-in `local`
|
||||
* backend is the llama-server serving the UI. External backends are
|
||||
* user-configured endpoints that speak an OpenAI- or Anthropic-compatible
|
||||
* protocol.
|
||||
*/
|
||||
|
||||
/** Request/response shape a backend speaks. */
|
||||
export type BackendProtocol = 'llama.cpp' | 'openai' | 'anthropic';
|
||||
|
||||
/** One configured API endpoint. */
|
||||
export interface Backend {
|
||||
/** Bearer token / API key used for this backend. */
|
||||
apiKey?: string;
|
||||
/**
|
||||
* API root the endpoint paths are appended to, e.g. https://api.example.com.
|
||||
* Empty for the local backend, which resolves against the UI origin instead.
|
||||
*/
|
||||
baseUrl: string;
|
||||
/** Disabled backends stay configured but are not queried. */
|
||||
enabled: boolean;
|
||||
/** Extra headers merged into every request to this backend. */
|
||||
headers?: Record<string, string>;
|
||||
/** Stable identity. The local backend id is reserved. */
|
||||
id: string;
|
||||
name: string;
|
||||
protocol: BackendProtocol;
|
||||
}
|
||||
@@ -35,6 +35,9 @@ export type {
|
||||
ApiStreamSession
|
||||
} from './api';
|
||||
|
||||
// Backend types
|
||||
export type { Backend, BackendProtocol } from './backend';
|
||||
|
||||
// HuggingFace types
|
||||
export type {
|
||||
HfCatalogBuild,
|
||||
|
||||
Reference in New Issue
Block a user