mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-06-23 21:57:19 +08:00
- Deleted `geminicli` provider and related `Apply` logic. - Removed all translator packages specific to Gemini CLI (Claude, Codex integrations). - Purged associated test files for Gemini CLI translation. - Removed `GeminiAuthenticator` and all associated authentication logic (OAuth flows, token handling, refresh logic). - Deleted internal/executor Gemini OAuth support, including bearer token handling and runtime API logic. - Purged all tests, configs, and command-line flags specific to Gemini OAuth flows. - Updated documentation and aliases to reflect Gemini removal. - Renamed `parseRetryDelay` to `ParseRetryDelay` and `deleteJSONField` to `DeleteJSONField`. - Updated references in `antigravity_executor` and tests to use the new `helps` package. - Adjusted import paths and test cases to ensure compatibility with the new location. - Updated README files to reflect changes in the retry logic references. - Updated `.github/ISSUE_TEMPLATE/bug_report.md` to remove deprecated Gemini CLI mention.
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
package common
|
|
|
|
import (
|
|
"strconv"
|
|
)
|
|
|
|
func GeminiTokenCountJSON(count int64) []byte {
|
|
out := make([]byte, 0, 96)
|
|
out = append(out, `{"totalTokens":`...)
|
|
out = strconv.AppendInt(out, count, 10)
|
|
out = append(out, `,"promptTokensDetails":[{"modality":"TEXT","tokenCount":`...)
|
|
out = strconv.AppendInt(out, count, 10)
|
|
out = append(out, `}]}`...)
|
|
return out
|
|
}
|
|
|
|
func ClaudeInputTokensJSON(count int64) []byte {
|
|
out := make([]byte, 0, 32)
|
|
out = append(out, `{"input_tokens":`...)
|
|
out = strconv.AppendInt(out, count, 10)
|
|
out = append(out, '}')
|
|
return out
|
|
}
|
|
|
|
func SSEEventData(event string, payload []byte) []byte {
|
|
out := make([]byte, 0, len(event)+len(payload)+14)
|
|
out = append(out, "event: "...)
|
|
out = append(out, event...)
|
|
out = append(out, '\n')
|
|
out = append(out, "data: "...)
|
|
out = append(out, payload...)
|
|
return out
|
|
}
|
|
|
|
func AppendSSEEventString(out []byte, event, payload string, trailingNewlines int) []byte {
|
|
out = append(out, "event: "...)
|
|
out = append(out, event...)
|
|
out = append(out, '\n')
|
|
out = append(out, "data: "...)
|
|
out = append(out, payload...)
|
|
for i := 0; i < trailingNewlines; i++ {
|
|
out = append(out, '\n')
|
|
}
|
|
return out
|
|
}
|
|
|
|
func AppendSSEEventBytes(out []byte, event string, payload []byte, trailingNewlines int) []byte {
|
|
out = append(out, "event: "...)
|
|
out = append(out, event...)
|
|
out = append(out, '\n')
|
|
out = append(out, "data: "...)
|
|
out = append(out, payload...)
|
|
for i := 0; i < trailingNewlines; i++ {
|
|
out = append(out, '\n')
|
|
}
|
|
return out
|
|
}
|