mirror of
https://github.com/fbarrca/obsidian-inlineAI.git
synced 2026-07-22 11:50:24 +00:00
Add type any to the errors
This commit is contained in:
parent
d4c778b440
commit
8f40589c6d
1 changed files with 5 additions and 5 deletions
10
src/api.ts
10
src/api.ts
|
|
@ -70,7 +70,7 @@ export class ChatApiManager {
|
|||
new Notice(`⚠️ Unsupported provider: ${settings.provider}`);
|
||||
return null;
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error("Error initializing chat client:", error);
|
||||
new Notice(`❌ Error initializing chat client: ${error.message}`);
|
||||
return null;
|
||||
|
|
@ -97,7 +97,7 @@ export class ChatApiManager {
|
|||
try {
|
||||
const aiMessage: AIMessage = await this.chatClient.invoke(messages);
|
||||
return aiMessage.content.toString();
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error("Error calling the chat model:", error);
|
||||
new Notice(`❌ Error calling the chat model: ${error.message}`);
|
||||
return "⚠️ Failed to generate a response. Please try again later.";
|
||||
|
|
@ -127,7 +127,7 @@ export class ChatApiManager {
|
|||
});
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error("Error processing request:", error);
|
||||
new Notice(`❌ Error processing request: ${error.message}`);
|
||||
return "⚠️ Failed to process request.";
|
||||
|
|
@ -160,7 +160,7 @@ export class ChatApiManager {
|
|||
|
||||
const systemPrompt = isCursor ? this.settings.cursorPrompt : this.settings.selectionPrompt;
|
||||
let userPrompt = ``;
|
||||
|
||||
|
||||
if (isCursor) {
|
||||
userPrompt = `
|
||||
**Task:** ${prompt}
|
||||
|
|
@ -173,7 +173,7 @@ export class ChatApiManager {
|
|||
|
||||
**Output:**`;
|
||||
}
|
||||
return this.handleEditorUpdate(systemPrompt, userPrompt);
|
||||
return this.handleEditorUpdate(systemPrompt, userPrompt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue