refactor: make providers use dedicated session handling classes

This commit is contained in:
Haileyesus
2026-04-21 12:59:41 +03:00
parent 7720578bc8
commit a2ef1d77a8
13 changed files with 1256 additions and 1262 deletions

View File

@@ -1,10 +1,5 @@
import type { IProvider, IProviderAuth, IProviderMcp } from '@/shared/interfaces.js';
import type {
FetchHistoryOptions,
FetchHistoryResult,
LLMProvider,
NormalizedMessage,
} from '@/shared/types.js';
import type { IProvider, IProviderAuth, IProviderMcp, IProviderSessions } from '@/shared/interfaces.js';
import type { LLMProvider } from '@/shared/types.js';
/**
* Shared provider base.
@@ -17,15 +12,9 @@ export abstract class AbstractProvider implements IProvider {
readonly id: LLMProvider;
abstract readonly mcp: IProviderMcp;
abstract readonly auth: IProviderAuth;
abstract readonly sessions: IProviderSessions;
protected constructor(id: LLMProvider) {
this.id = id;
}
abstract normalizeMessage(raw: unknown, sessionId: string | null): NormalizedMessage[];
abstract fetchHistory(
sessionId: string,
options?: FetchHistoryOptions,
): Promise<FetchHistoryResult>;
}