Skip to content

Commit 22391e5

Browse files
committed
Fix type errors
1 parent b2b135c commit 22391e5

File tree

7 files changed

+16
-33
lines changed

7 files changed

+16
-33
lines changed

src/api/transform/bedrock-converse-format.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ export function convertToAnthropicMessage(
193193
usage: {
194194
input_tokens: streamEvent.metadata.usage.inputTokens || 0,
195195
output_tokens: streamEvent.metadata.usage.outputTokens || 0,
196+
cache_creation_input_tokens: null,
197+
cache_read_input_tokens: null,
196198
},
197199
}
198200
}
@@ -203,7 +205,7 @@ export function convertToAnthropicMessage(
203205
return {
204206
type: "message",
205207
role: "assistant",
206-
content: [{ type: "text", text: text }],
208+
content: [{ type: "text", text: text, citations: null }],
207209
model: modelId,
208210
}
209211
}

src/api/transform/gemini-format.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,7 @@ import {
1111
TextPart,
1212
} from "@google/generative-ai"
1313

14-
export function convertAnthropicContentToGemini(
15-
content:
16-
| string
17-
| Array<
18-
| Anthropic.Messages.TextBlockParam
19-
| Anthropic.Messages.ImageBlockParam
20-
| Anthropic.Messages.ToolUseBlockParam
21-
| Anthropic.Messages.ToolResultBlockParam
22-
>,
23-
): Part[] {
14+
export function convertAnthropicContentToGemini(content: Anthropic.Messages.MessageParam["content"]): Part[] {
2415
if (typeof content === "string") {
2516
return [{ text: content } as TextPart]
2617
}
@@ -140,7 +131,7 @@ export function convertGeminiResponseToAnthropic(
140131
// Add the main text response
141132
const text = response.text()
142133
if (text) {
143-
content.push({ type: "text", text })
134+
content.push({ type: "text", text, citations: null })
144135
}
145136

146137
// Add function calls as tool_use blocks
@@ -190,6 +181,8 @@ export function convertGeminiResponseToAnthropic(
190181
usage: {
191182
input_tokens: response.usageMetadata?.promptTokenCount ?? 0,
192183
output_tokens: response.usageMetadata?.candidatesTokenCount ?? 0,
184+
cache_creation_input_tokens: null,
185+
cache_read_input_tokens: null,
193186
},
194187
}
195188
}

src/api/transform/openai-format.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export function convertToAnthropicMessage(
158158
{
159159
type: "text",
160160
text: openAiMessage.content || "",
161+
citations: null,
161162
},
162163
],
163164
model: completion.model,
@@ -178,6 +179,8 @@ export function convertToAnthropicMessage(
178179
usage: {
179180
input_tokens: completion.usage?.prompt_tokens || 0,
180181
output_tokens: completion.usage?.completion_tokens || 0,
182+
cache_creation_input_tokens: null,
183+
cache_read_input_tokens: null,
181184
},
182185
}
183186

src/api/transform/simple-format.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,7 @@ import { Anthropic } from "@anthropic-ai/sdk"
33
/**
44
* Convert complex content blocks to simple string content
55
*/
6-
export function convertToSimpleContent(
7-
content:
8-
| string
9-
| Array<
10-
| Anthropic.Messages.TextBlockParam
11-
| Anthropic.Messages.ImageBlockParam
12-
| Anthropic.Messages.ToolUseBlockParam
13-
| Anthropic.Messages.ToolResultBlockParam
14-
>,
15-
): string {
6+
export function convertToSimpleContent(content: Anthropic.Messages.MessageParam["content"]): string {
167
if (typeof content === "string") {
178
return content
189
}

src/api/transform/vscode-lm-format.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export async function convertToAnthropicMessage(
175175
return {
176176
type: "text",
177177
text: part.value,
178+
citations: null,
178179
}
179180
}
180181

@@ -195,6 +196,8 @@ export async function convertToAnthropicMessage(
195196
usage: {
196197
input_tokens: 0,
197198
output_tokens: 0,
199+
cache_creation_input_tokens: null,
200+
cache_read_input_tokens: null,
198201
},
199202
}
200203
}

src/core/Cline.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ const cwd =
6969
vscode.workspace.workspaceFolders?.map((folder) => folder.uri.fsPath).at(0) ?? path.join(os.homedir(), "Desktop") // may or may not exist but fs checking existence would immediately ask for permission which would be bad UX, need to come up with a better solution
7070

7171
type ToolResponse = string | Array<Anthropic.TextBlockParam | Anthropic.ImageBlockParam>
72-
type UserContent = Array<
73-
Anthropic.TextBlockParam | Anthropic.ImageBlockParam | Anthropic.ToolUseBlockParam | Anthropic.ToolResultBlockParam
74-
>
72+
type UserContent = Array<Anthropic.Messages.ContentBlockParam>
7573

7674
export type ClineOptions = {
7775
provider: ClineProvider

src/integrations/misc/export-markdown.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,7 @@ export async function downloadTask(dateTs: number, conversationHistory: Anthropi
4141
}
4242
}
4343

44-
export function formatContentBlockToMarkdown(
45-
block:
46-
| Anthropic.TextBlockParam
47-
| Anthropic.ImageBlockParam
48-
| Anthropic.ToolUseBlockParam
49-
| Anthropic.ToolResultBlockParam,
50-
// messages: Anthropic.MessageParam[]
51-
): string {
44+
export function formatContentBlockToMarkdown(block: Anthropic.Messages.ContentBlockParam): string {
5245
switch (block.type) {
5346
case "text":
5447
return block.text

0 commit comments

Comments
 (0)