89 lines
2.3 KiB
TypeScript
Executable File
89 lines
2.3 KiB
TypeScript
Executable File
export namespace handler {
|
|
|
|
export class LibraryInfo {
|
|
id: number;
|
|
name: string;
|
|
description: string;
|
|
entry_count: number;
|
|
is_active: boolean;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new LibraryInfo(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.name = source["name"];
|
|
this.description = source["description"];
|
|
this.entry_count = source["entry_count"];
|
|
this.is_active = source["is_active"];
|
|
}
|
|
}
|
|
export class ProviderPreset {
|
|
id: string;
|
|
label: string;
|
|
base_url: string;
|
|
default_model: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ProviderPreset(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.id = source["id"];
|
|
this.label = source["label"];
|
|
this.base_url = source["base_url"];
|
|
this.default_model = source["default_model"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
export namespace service {
|
|
|
|
export class ImportResult {
|
|
imported: number;
|
|
skipped: number;
|
|
error?: string;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new ImportResult(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.imported = source["imported"];
|
|
this.skipped = source["skipped"];
|
|
this.error = source["error"];
|
|
}
|
|
}
|
|
export class SettingsDTO {
|
|
ai_provider: string;
|
|
base_url: string;
|
|
api_key: string;
|
|
model: string;
|
|
system_prompt: string;
|
|
max_tokens: number;
|
|
use_public_key: boolean;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new SettingsDTO(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.ai_provider = source["ai_provider"];
|
|
this.base_url = source["base_url"];
|
|
this.api_key = source["api_key"];
|
|
this.model = source["model"];
|
|
this.system_prompt = source["system_prompt"];
|
|
this.max_tokens = source["max_tokens"];
|
|
this.use_public_key = source["use_public_key"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|