mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix: update buildApiHandler return type to support prompt enhancement
- Changed buildApiHandler return type from ApiHandler to ApiHandler & Partial<SingleCompletionHandler> - Updated singleCompletionHandler to check for completePrompt method existence - This fixes the "Failed to enhance prompt" error by properly exposing the completePrompt method Fixes #6529
This commit is contained in:
parent
5c05762333
commit
56754712f4
2 changed files with 3 additions and 3 deletions
|
|
@ -64,7 +64,7 @@ export interface ApiHandler {
|
|||
countTokens(content: Array<Anthropic.Messages.ContentBlockParam>): Promise<number>
|
||||
}
|
||||
|
||||
export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
|
||||
export function buildApiHandler(configuration: ProviderSettings): ApiHandler & Partial<SingleCompletionHandler> {
|
||||
const { apiProvider, ...options } = configuration
|
||||
|
||||
switch (apiProvider) {
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ export async function singleCompletionHandler(apiConfiguration: ProviderSettings
|
|||
const handler = buildApiHandler(apiConfiguration)
|
||||
|
||||
// Check if handler supports single completions
|
||||
if (!("completePrompt" in handler)) {
|
||||
if (!handler.completePrompt) {
|
||||
throw new Error("The selected API provider does not support prompt enhancement")
|
||||
}
|
||||
|
||||
return (handler as SingleCompletionHandler).completePrompt(promptText)
|
||||
return handler.completePrompt(promptText)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue