mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 02:52:27 +08:00
40 lines
824 B
TypeScript
40 lines
824 B
TypeScript
![]() |
export interface Message {
|
||
|
role: 'user' | 'assistant' | 'system';
|
||
|
content: string;
|
||
|
}
|
||
|
|
||
|
export interface ChatCompletionOptions {
|
||
|
model?: string;
|
||
|
temperature?: number;
|
||
|
maxTokens?: number;
|
||
|
systemPrompt?: string;
|
||
|
}
|
||
|
|
||
|
export interface ChatResponse {
|
||
|
text: string;
|
||
|
model: string;
|
||
|
provider: string;
|
||
|
usage?: {
|
||
|
promptTokens?: number;
|
||
|
completionTokens?: number;
|
||
|
totalTokens?: number;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
export interface AIService {
|
||
|
/**
|
||
|
* Generate a chat completion response
|
||
|
*/
|
||
|
generateChatCompletion(messages: Message[], options?: ChatCompletionOptions): Promise<ChatResponse>;
|
||
|
|
||
|
/**
|
||
|
* Check if the service can be used (API key is set, etc.)
|
||
|
*/
|
||
|
isAvailable(): boolean;
|
||
|
|
||
|
/**
|
||
|
* Get the name of the service
|
||
|
*/
|
||
|
getName(): string;
|
||
|
}
|