Skip to content

Commit

Permalink
sync with ccat's develop branch
Browse files Browse the repository at this point in the history
  • Loading branch information
zAlweNy26 committed Aug 5, 2023
1 parent 70da5c4 commit b54418b
Show file tree
Hide file tree
Showing 20 changed files with 508 additions and 255 deletions.
24 changes: 12 additions & 12 deletions api/CCatAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ import type { BaseHttpRequest } from './core/BaseHttpRequest';
import type { OpenAPIConfig } from './core/OpenAPI';
import { AxiosHttpRequest } from './core/AxiosHttpRequest';

import { EmbedderService } from './services/EmbedderService';
import { LargeLanguageModelService } from './services/LargeLanguageModelService';
import { MemoryService } from './services/MemoryService';
import { PluginsService } from './services/PluginsService';
import { PromptService } from './services/PromptService';
import { RabbitHoleService } from './services/RabbitHoleService';
import { SettingsEmbedderService } from './services/SettingsEmbedderService';
import { SettingsGeneralService } from './services/SettingsGeneralService';
import { SettingsLargeLanguageModelService } from './services/SettingsLargeLanguageModelService';
import { SettingsPromptService } from './services/SettingsPromptService';
import { SettingsService } from './services/SettingsService';
import { StatusService } from './services/StatusService';

type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;

export class CCatAPI {

public readonly embedder: EmbedderService;
public readonly largeLanguageModel: LargeLanguageModelService;
public readonly memory: MemoryService;
public readonly plugins: PluginsService;
public readonly prompt: PromptService;
public readonly rabbitHole: RabbitHoleService;
public readonly settingsEmbedder: SettingsEmbedderService;
public readonly settingsGeneral: SettingsGeneralService;
public readonly settingsLargeLanguageModel: SettingsLargeLanguageModelService;
public readonly settingsPrompt: SettingsPromptService;
public readonly settings: SettingsService;
public readonly status: StatusService;

public readonly request: BaseHttpRequest;
Expand All @@ -43,13 +43,13 @@ export class CCatAPI {
ENCODE_PATH: config?.ENCODE_PATH,
});

this.embedder = new EmbedderService(this.request);
this.largeLanguageModel = new LargeLanguageModelService(this.request);
this.memory = new MemoryService(this.request);
this.plugins = new PluginsService(this.request);
this.prompt = new PromptService(this.request);
this.rabbitHole = new RabbitHoleService(this.request);
this.settingsEmbedder = new SettingsEmbedderService(this.request);
this.settingsGeneral = new SettingsGeneralService(this.request);
this.settingsLargeLanguageModel = new SettingsLargeLanguageModelService(this.request);
this.settingsPrompt = new SettingsPromptService(this.request);
this.settings = new SettingsService(this.request);
this.status = new StatusService(this.request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
/* tslint:disable */
/* eslint-disable */

export type BodyUploadPlugin = {
export type BodyInstallPlugin = {
file: Blob;
};
2 changes: 1 addition & 1 deletion api/models/DeleteResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

export type DeleteResponse = {
status: string;
deleted: (string | Record<string, any>);
deleted: (string | boolean | Record<string, any>);
};
6 changes: 3 additions & 3 deletions api/models/HTTPValidationError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* tslint:disable */
/* eslint-disable */

import type { ValidationError } from './ValidationError';

export type HTTPValidationError = {
detail?: Array<ValidationError>;
detail?: {
error: string;
};
};
7 changes: 4 additions & 3 deletions api/models/JsonSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
export type JsonSchema = {
title: string;
type: string;
description: string;
description?: string;
properties: Record<string, any>;
required?: Array<string>;
additionalProperties: boolean;
required: Array<string>;
additionalProperties?: (boolean | Record<string, any>);
definitions?: Record<string, any>;
};
2 changes: 2 additions & 0 deletions api/models/MetaData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@
export type MetaData = {
source: string;
when: number;
docstring?: string;
name?: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import type { JsonSchema } from './JsonSchema';
import type { Setting } from './Setting';

export type ConfigurationsResponse = {
export type ModelsResponse = {
status: string;
results: number;
settings: Array<Setting>;
schemas: Record<string, (JsonSchema & {
name_human_readable?: string;
nameHumanReadable?: string;
})>;
allowed_configurations: Array<string>;
selected_configuration: string;
Expand Down
1 change: 1 addition & 0 deletions api/models/Plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export type Plugin = {
tags: string;
thumb: string;
version: string;
active?: boolean;
};
9 changes: 0 additions & 9 deletions api/models/PluginSettings.ts

This file was deleted.

14 changes: 14 additions & 0 deletions api/models/PluginsSettingsResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { JsonSchema } from './JsonSchema';
import type { Setting } from './Setting';

export type PluginsSettingsResponse = {
status: string;
results: number;
settings: Array<Setting>;
schemas: Record<string, JsonSchema>;
};
2 changes: 1 addition & 1 deletion api/models/SettingResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import type { Setting } from './Setting';

export type SettingResponse = {
status: string;
setting: Setting;
settings: Setting;
};
10 changes: 0 additions & 10 deletions api/models/ValidationError.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,53 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ConfigurationsResponse } from '../models/ConfigurationsResponse';
import type { JsonSchema } from '../models/JsonSchema';
import type { ModelsResponse } from '../models/ModelsResponse';
import type { SettingResponse } from '../models/SettingResponse';

import type { CancelablePromise } from '../core/CancelablePromise';
import type { BaseHttpRequest } from '../core/BaseHttpRequest';

export class SettingsEmbedderService {
export class EmbedderService {

constructor(private readonly httpRequest: BaseHttpRequest) {}

/**
* Get Embedder Settings
* Get Embedders Settings
* Get the list of the Embedders
* @returns ConfigurationsResponse Successful Response
* @returns ModelsResponse Successful Response
* @throws ApiError
*/
public getEmbeddersSettings(): CancelablePromise<ModelsResponse> {
return this.httpRequest.request({
method: 'GET',
url: '/embedder/settings/',
});
}

/**
* Get Embedder Settings
* Get settings and schema of the specified Embedder
* @param languageEmbedderName
* @returns any Successful Response
* @throws ApiError
*/
public getEmbedderSettings(): CancelablePromise<ConfigurationsResponse> {
public getEmbedderSettings(
languageEmbedderName: string,
): CancelablePromise<(SettingResponse & {
schema: (JsonSchema & {
nameHumanReadable?: string;
});
})> {
return this.httpRequest.request({
method: 'GET',
url: '/settings/embedder/',
url: '/embedder/settings/{languageEmbedderName}/',
path: {
'languageEmbedderName': languageEmbedderName,
},
errors: {
422: `Validation Error`,
},
});
}

Expand All @@ -39,7 +66,7 @@ requestBody: Record<string, any>,
): CancelablePromise<SettingResponse> {
return this.httpRequest.request({
method: 'PUT',
url: '/settings/embedder/{languageEmbedderName}',
url: '/embedder/settings/{languageEmbedderName}/',
path: {
'languageEmbedderName': languageEmbedderName,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,53 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ConfigurationsResponse } from '../models/ConfigurationsResponse';
import type { JsonSchema } from '../models/JsonSchema';
import type { ModelsResponse } from '../models/ModelsResponse';
import type { SettingResponse } from '../models/SettingResponse';

import type { CancelablePromise } from '../core/CancelablePromise';
import type { BaseHttpRequest } from '../core/BaseHttpRequest';

export class SettingsLargeLanguageModelService {
export class LargeLanguageModelService {

constructor(private readonly httpRequest: BaseHttpRequest) {}

/**
* Get LLM Settings
* Get LLMs Settings
* Get the list of the Large Language Models
* @returns ConfigurationsResponse Successful Response
* @returns ModelsResponse Successful Response
* @throws ApiError
*/
public getLlmSettings(): CancelablePromise<ConfigurationsResponse> {
public getLlmsSettings(): CancelablePromise<ModelsResponse> {
return this.httpRequest.request({
method: 'GET',
url: '/settings/llm/',
url: '/llm/settings/',
});
}

/**
* Get Llm Settings
* Get settings and schema of the specified Large Language Model
* @param languageModelName
* @returns any Successful Response
* @throws ApiError
*/
public getLlmSettings(
languageModelName: string,
): CancelablePromise<(SettingResponse & {
schema: (JsonSchema & {
nameHumanReadable?: string;
});
})> {
return this.httpRequest.request({
method: 'GET',
url: '/llm/settings/{languageModelName}/',
path: {
'languageModelName': languageModelName,
},
errors: {
422: `Validation Error`,
},
});
}

Expand All @@ -39,7 +66,7 @@ requestBody: Record<string, any>,
): CancelablePromise<SettingResponse> {
return this.httpRequest.request({
method: 'PUT',
url: '/settings/llm/{languageModelName}',
url: '/llm/settings/{languageModelName}/',
path: {
'languageModelName': languageModelName,
},
Expand Down
Loading

0 comments on commit b54418b

Please sign in to comment.