Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/engine/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class AnthropicEngine implements AiEngine {
this.config = config;
const clientOptions: any = { apiKey: this.config.apiKey };

if (this.config.baseURL) {
clientOptions.baseURL = this.config.baseURL;
}

const proxy = config.proxy;
if (proxy) {
clientOptions.httpAgent = new HttpsProxyAgent(proxy);
Expand Down Expand Up @@ -65,7 +69,8 @@ export class AnthropicEngine implements AiEngine {

const data = await this.client.messages.create(params);

const message = data?.content[0].text;
const textBlock = data?.content?.find((b) => b.type === 'text');
const message = textBlock && 'text' in textBlock ? textBlock.text : undefined;
let content = message;
return removeContentTags(content, 'think');
} catch (error) {
Expand Down