37 lines
759 B
TypeScript
37 lines
759 B
TypeScript
import { api } from './api';
|
|
|
|
export interface AiModelOption {
|
|
id: string;
|
|
label: string;
|
|
}
|
|
|
|
export interface ModelsResponse {
|
|
default: string;
|
|
models: AiModelOption[];
|
|
}
|
|
|
|
export interface CopyRequest {
|
|
source_text: string;
|
|
model_code?: string;
|
|
model?: string;
|
|
}
|
|
|
|
export interface CopyResponse {
|
|
titles_ru: string[];
|
|
titles_zh: string[];
|
|
description_ru: string;
|
|
description_zh: string;
|
|
tags_ru: string[];
|
|
tags_zh: string[];
|
|
model: string;
|
|
usage: { prompt_tokens: number; completion_tokens: number };
|
|
}
|
|
|
|
export function getAiModels() {
|
|
return api.get<ModelsResponse>('/ai/models');
|
|
}
|
|
|
|
export function generateCopy(payload: CopyRequest) {
|
|
return api.post<CopyResponse>('/ai/copy', payload);
|
|
}
|