Skip to content

Commit 22baa0e

Browse files
authored
Merge pull request #26 from filiptrplan/master
A fix for countTokens and a dockerfile improvement
2 parents 72ffc62 + 0fdb836 commit 22baa0e

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ COPY --from=builder /app/dist ./dist
1717

1818
EXPOSE 4141
1919

20-
CMD ["bun", "run", "dist/main.js"]
20+
ARG GH_TOKEN
21+
ENV GH_TOKEN=$GH_TOKEN
22+
23+
CMD bun run dist/main.js start -g $GH_TOKEN --vision

src/lib/tokenizer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { countTokens } from "gpt-tokenizer/model/gpt-4o"
33
import type { Message } from "~/services/copilot/create-chat-completions"
44

55
export const getTokenCount = (messages: Array<Message>) => {
6-
const input = messages.filter((m) => m.role !== "assistant")
6+
const input = messages.filter(
7+
(m) => m.role !== "assistant" && typeof m.content === "string",
8+
)
9+
console.log(input)
710
const output = messages.filter((m) => m.role === "assistant")
811

912
const inputTokens = countTokens(input)

0 commit comments

Comments
 (0)