-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94a91bb
commit 91dcf7a
Showing
5 changed files
with
48 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// src/services/claude-api.ts | ||
import * as vscode from 'vscode'; | ||
import { askClaude as apiAskClaude, ClaudeResponse } from '../api'; | ||
|
||
export interface ClaudeApiService { | ||
askClaude(text: string): Promise<ClaudeResponse>; | ||
} | ||
|
||
export class DefaultClaudeApiService implements ClaudeApiService { | ||
private readonly _disposables: vscode.Disposable[] = []; | ||
|
||
constructor() { | ||
// Add any initialization if needed | ||
} | ||
|
||
async askClaude(text: string): Promise<ClaudeResponse> { | ||
try { | ||
return await apiAskClaude(text); | ||
} catch (error) { | ||
console.error('Error in DefaultClaudeApiService:', error); | ||
throw error; | ||
} | ||
} | ||
|
||
dispose(): void { | ||
while (this._disposables.length) { | ||
const disposable = this._disposables.pop(); | ||
if (disposable) { | ||
try { | ||
disposable.dispose(); | ||
} catch (error) { | ||
console.error('Error disposing service:', error); | ||
} | ||
} | ||
} | ||
} | ||
} |