feat: update config endpoints for use with providers (#1563)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
import type { Options as ClientOptions, TDataShape, Client } from '@hey-api/client-fetch';
|
||||
import type { ReadAllConfigData, ReadAllConfigResponse, RemoveExtensionData, RemoveExtensionResponse, AddExtensionData, AddExtensionResponse, UpdateExtensionData, UpdateExtensionResponse, ReadConfigData, RemoveConfigData, RemoveConfigResponse, UpsertConfigData, UpsertConfigResponse } from './types.gen';
|
||||
import type { ReadAllConfigData, ReadAllConfigResponse, RemoveExtensionData, RemoveExtensionResponse, AddExtensionData, AddExtensionResponse, UpdateExtensionData, UpdateExtensionResponse, ProvidersData, ProvidersResponse2, ReadConfigData, RemoveConfigData, RemoveConfigResponse, UpsertConfigData, UpsertConfigResponse } from './types.gen';
|
||||
import { client as _heyApiClient } from './client.gen';
|
||||
|
||||
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<TData, ThrowOnError> & {
|
||||
@@ -58,6 +58,13 @@ export const updateExtension = <ThrowOnError extends boolean = false>(options: O
|
||||
});
|
||||
};
|
||||
|
||||
export const providers = <ThrowOnError extends boolean = false>(options?: Options<ProvidersData, ThrowOnError>) => {
|
||||
return (options?.client ?? _heyApiClient).get<ProvidersResponse2, unknown, ThrowOnError>({
|
||||
url: '/config/providers',
|
||||
...options
|
||||
});
|
||||
};
|
||||
|
||||
export const readConfig = <ThrowOnError extends boolean = false>(options: Options<ReadConfigData, ThrowOnError>) => {
|
||||
return (options.client ?? _heyApiClient).get<unknown, unknown, ThrowOnError>({
|
||||
url: '/config/read',
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
// This file is auto-generated by @hey-api/openapi-ts
|
||||
|
||||
export type ConfigKey = {
|
||||
default?: string | null;
|
||||
name: string;
|
||||
required: boolean;
|
||||
secret: boolean;
|
||||
};
|
||||
|
||||
export type ConfigKeyQuery = {
|
||||
is_secret: boolean;
|
||||
key: string;
|
||||
};
|
||||
|
||||
@@ -13,8 +21,59 @@ export type ExtensionQuery = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type ProviderDetails = {
|
||||
/**
|
||||
* Indicates whether the provider is fully configured
|
||||
*/
|
||||
is_configured: boolean;
|
||||
metadata: ProviderMetadata;
|
||||
/**
|
||||
* Unique identifier and name of the provider
|
||||
*/
|
||||
name: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Metadata about a provider's configuration requirements and capabilities
|
||||
*/
|
||||
export type ProviderMetadata = {
|
||||
/**
|
||||
* Required configuration keys
|
||||
*/
|
||||
config_keys: Array<ConfigKey>;
|
||||
/**
|
||||
* The default/recommended model for this provider
|
||||
*/
|
||||
default_model: string;
|
||||
/**
|
||||
* Description of the provider's capabilities
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* Display name for the provider in UIs
|
||||
*/
|
||||
display_name: string;
|
||||
/**
|
||||
* A list of currently known models
|
||||
* TODO: eventually query the apis directly
|
||||
*/
|
||||
known_models: Array<string>;
|
||||
/**
|
||||
* Link to the docs where models can be found
|
||||
*/
|
||||
model_doc_link: string;
|
||||
/**
|
||||
* The unique identifier for this provider
|
||||
*/
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type ProvidersResponse = {
|
||||
providers: Array<ProviderDetails>;
|
||||
};
|
||||
|
||||
export type UpsertConfigQuery = {
|
||||
is_secret?: boolean | null;
|
||||
is_secret: boolean;
|
||||
key: string;
|
||||
value: unknown;
|
||||
};
|
||||
@@ -116,6 +175,22 @@ export type UpdateExtensionResponses = {
|
||||
|
||||
export type UpdateExtensionResponse = UpdateExtensionResponses[keyof UpdateExtensionResponses];
|
||||
|
||||
export type ProvidersData = {
|
||||
body?: never;
|
||||
path?: never;
|
||||
query?: never;
|
||||
url: '/config/providers';
|
||||
};
|
||||
|
||||
export type ProvidersResponses = {
|
||||
/**
|
||||
* All configuration values retrieved successfully
|
||||
*/
|
||||
200: Array<ProviderDetails>;
|
||||
};
|
||||
|
||||
export type ProvidersResponse2 = ProvidersResponses[keyof ProvidersResponses];
|
||||
|
||||
export type ReadConfigData = {
|
||||
body: ConfigKeyQuery;
|
||||
path?: never;
|
||||
|
||||
Reference in New Issue
Block a user