Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ COPY --from=builder /app/dist ./dist

EXPOSE 4141

CMD ["bun", "run", "dist/main.js"]
ARG GH_TOKEN
ENV GH_TOKEN=$GH_TOKEN

CMD bun run dist/main.js start -g $GH_TOKEN --vision
5 changes: 4 additions & 1 deletion src/lib/tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { countTokens } from "gpt-tokenizer/model/gpt-4o"
import type { Message } from "~/services/copilot/create-chat-completions"

export const getTokenCount = (messages: Array<Message>) => {
const input = messages.filter((m) => m.role !== "assistant")
const input = messages.filter(
(m) => m.role !== "assistant" && typeof m.content === "string",
)
console.log(input)
const output = messages.filter((m) => m.role === "assistant")

const inputTokens = countTokens(input)
Expand Down