Skip to content

Commit

Permalink
Reactors AI providers to simplify provider APIs
Browse files Browse the repository at this point in the history
- Splits code into separate folders, e.g. models, utils
- Adds structured prompt template handling
- Simplifies provider APIs and request handling
  • Loading branch information
eamodio committed Mar 6, 2025
1 parent f18c6b6 commit fa3bd63
Show file tree
Hide file tree
Showing 25 changed files with 973 additions and 1,367 deletions.
419 changes: 0 additions & 419 deletions src/ai/openAICompatibleProvider.ts

This file was deleted.

416 changes: 0 additions & 416 deletions src/ai/vscodeProvider.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/commands/git/stash.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { QuickInputButton, QuickPickItem, Uri } from 'vscode';
import { InputBoxValidationSeverity, QuickInputButtons, ThemeIcon, window } from 'vscode';
import type { AIModel } from '../../ai/aiProviderService';
import { GlyphChars } from '../../constants';
import type { Container } from '../../container';
import { reveal, showDetailsView } from '../../git/actions/stash';
Expand All @@ -11,6 +10,7 @@ import type { Repository } from '../../git/models/repository';
import { uncommitted, uncommittedStaged } from '../../git/models/revision';
import { getReferenceLabel } from '../../git/utils/reference.utils';
import { showGenericErrorMessage } from '../../messages';
import type { AIModel } from '../../plus/ai/models/model';
import type { QuickPickItemOfT } from '../../quickpicks/items/common';
import type { FlagsQuickPickItem } from '../../quickpicks/items/flags';
import { createFlagsQuickPickItem } from '../../quickpicks/items/flags';
Expand Down
4 changes: 2 additions & 2 deletions src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
getSupportedRepositoryLocationProvider,
getSupportedWorkspacesStorageProvider,
} from '@env/providers';
import { AIProviderService } from './ai/aiProviderService';
import { FileAnnotationController } from './annotations/fileAnnotationController';
import { LineAnnotationController } from './annotations/lineAnnotationController';
import { ActionRunners } from './api/actionRunners';
Expand All @@ -24,6 +23,7 @@ import { GitFileSystemProvider } from './git/fsProvider';
import { GitProviderService } from './git/gitProviderService';
import type { RepositoryLocationProvider } from './git/location/repositorylocationProvider';
import { LineHoverController } from './hovers/lineHoverController';
import { AIProviderService } from './plus/ai/aiProviderService';
import { DraftService } from './plus/drafts/draftsService';
import { AccountAuthenticationProvider } from './plus/gk/authenticationProvider';
import { OrganizationService } from './plus/gk/organizationService';
Expand Down Expand Up @@ -349,7 +349,7 @@ export class Container {
private _ai: AIProviderService | undefined;
get ai(): AIProviderService {
if (this._ai == null) {
this._disposables.push((this._ai = new AIProviderService(this)));
this._disposables.push((this._ai = new AIProviderService(this, this._connection)));
}
return this._ai;
}
Expand Down
2 changes: 1 addition & 1 deletion src/git/utils/-webview/log.utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AIGenerateChangelogChange } from '../../../ai/aiProviderService';
import type { Autolink } from '../../../autolinks/models/autolinks';
import type { Container } from '../../../container';
import type { AIGenerateChangelogChange } from '../../../plus/ai/aiProviderService';
import { filterMap, map } from '../../../system/iterable';
import { getSettledValue } from '../../../system/promise';
import type { IssueOrPullRequest } from '../../models/issueOrPullRequest';
Expand Down
Loading

0 comments on commit fa3bd63

Please sign in to comment.