Skip to content

Commit 22e18dd

Browse files
committed
Clean up imports
1 parent 38d5bf6 commit 22e18dd

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/api/providers/base-provider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ export abstract class BaseProvider implements ApiHandler {
4242
if (block.type === "text") {
4343
// Use tiktoken for text token counting
4444
const text = block.text || ""
45+
4546
if (text.length > 0) {
4647
const tokens = this.encoder.encode(text)
4748
totalTokens += tokens.length
4849
}
4950
} else if (block.type === "image") {
5051
// For images, calculate based on data size
5152
const imageSource = block.source
53+
5254
if (imageSource && typeof imageSource === "object" && "data" in imageSource) {
5355
const base64Data = imageSource.data as string
5456
totalTokens += Math.ceil(Math.sqrt(base64Data.length))

src/core/sliding-window/__tests__/sliding-window.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
import { Anthropic } from "@anthropic-ai/sdk"
44

55
import { ModelInfo } from "../../../shared/api"
6-
import { ApiHandler } from "../../../api"
76
import { BaseProvider } from "../../../api/providers/base-provider"
8-
import { TOKEN_BUFFER_PERCENTAGE } from "../index"
9-
import { estimateTokenCount, truncateConversation, truncateConversationIfNeeded } from "../index"
7+
import {
8+
TOKEN_BUFFER_PERCENTAGE,
9+
estimateTokenCount,
10+
truncateConversation,
11+
truncateConversationIfNeeded,
12+
} from "../index"
1013

1114
// Create a mock ApiHandler for testing
1215
class MockApiHandler extends BaseProvider {

0 commit comments

Comments
 (0)