mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 13:00:52 +08:00
refactor: standardize constant naming and improve file-based auth handling
- Renamed constants from uppercase to CamelCase for consistency. - Replaced redundant file-based auth handling logic with the new `util.CountAuthFiles` helper. - Fixed various error-handling inconsistencies and enhanced robustness in file operations. - Streamlined auth client reload logic in server and watcher components. - Applied minor code readability improvements across multiple packages.
This commit is contained in:
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINICLI,
|
||||
CLAUDE,
|
||||
GeminiCLI,
|
||||
Claude,
|
||||
ConvertGeminiCLIRequestToClaude,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertClaudeResponseToGeminiCLI,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINI,
|
||||
CLAUDE,
|
||||
Gemini,
|
||||
Claude,
|
||||
ConvertGeminiRequestToClaude,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertClaudeResponseToGemini,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI,
|
||||
CLAUDE,
|
||||
OpenAI,
|
||||
Claude,
|
||||
ConvertOpenAIRequestToClaude,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertClaudeResponseToOpenAI,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI_RESPONSE,
|
||||
CLAUDE,
|
||||
OpenaiResponse,
|
||||
Claude,
|
||||
ConvertOpenAIResponsesRequestToClaude,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertClaudeResponseToOpenAIResponses,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
CLAUDE,
|
||||
CODEX,
|
||||
Claude,
|
||||
Codex,
|
||||
ConvertClaudeRequestToCodex,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertCodexResponseToClaude,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINICLI,
|
||||
CODEX,
|
||||
GeminiCLI,
|
||||
Codex,
|
||||
ConvertGeminiCLIRequestToCodex,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertCodexResponseToGeminiCLI,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINI,
|
||||
CODEX,
|
||||
Gemini,
|
||||
Codex,
|
||||
ConvertGeminiRequestToCodex,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertCodexResponseToGemini,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI,
|
||||
CODEX,
|
||||
OpenAI,
|
||||
Codex,
|
||||
ConvertOpenAIRequestToCodex,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertCodexResponseToOpenAI,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI_RESPONSE,
|
||||
CODEX,
|
||||
OpenaiResponse,
|
||||
Codex,
|
||||
ConvertOpenAIResponsesRequestToCodex,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertCodexResponseToOpenAIResponses,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
CLAUDE,
|
||||
GEMINICLI,
|
||||
Claude,
|
||||
GeminiCLI,
|
||||
ConvertClaudeRequestToCLI,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertGeminiCLIResponseToClaude,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINI,
|
||||
GEMINICLI,
|
||||
Gemini,
|
||||
GeminiCLI,
|
||||
ConvertGeminiRequestToGeminiCLI,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertGeminiCliRequestToGemini,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI,
|
||||
GEMINICLI,
|
||||
OpenAI,
|
||||
GeminiCLI,
|
||||
ConvertOpenAIRequestToGeminiCLI,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertCliResponseToOpenAI,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI_RESPONSE,
|
||||
GEMINICLI,
|
||||
OpenaiResponse,
|
||||
GeminiCLI,
|
||||
ConvertOpenAIResponsesRequestToGeminiCLI,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertGeminiCLIResponseToOpenAIResponses,
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI,
|
||||
GEMINIWEB,
|
||||
OpenAI,
|
||||
GeminiWeb,
|
||||
geminiChat.ConvertOpenAIRequestToGemini,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: geminiChat.ConvertGeminiResponseToOpenAI,
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI_RESPONSE,
|
||||
GEMINIWEB,
|
||||
OpenaiResponse,
|
||||
GeminiWeb,
|
||||
geminiResponses.ConvertOpenAIResponsesRequestToGemini,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: geminiResponses.ConvertGeminiResponseToOpenAIResponses,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
CLAUDE,
|
||||
GEMINI,
|
||||
Claude,
|
||||
Gemini,
|
||||
ConvertClaudeRequestToGemini,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertGeminiResponseToClaude,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINICLI,
|
||||
GEMINI,
|
||||
GeminiCLI,
|
||||
Gemini,
|
||||
ConvertGeminiCLIRequestToGemini,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertGeminiResponseToGeminiCLI,
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
// The request converter ensures missing or invalid roles are normalized to valid values.
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINI,
|
||||
GEMINI,
|
||||
Gemini,
|
||||
Gemini,
|
||||
ConvertGeminiRequestToGemini,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: PassthroughGeminiResponseStream,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI,
|
||||
GEMINI,
|
||||
OpenAI,
|
||||
Gemini,
|
||||
ConvertOpenAIRequestToGemini,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertGeminiResponseToOpenAI,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI_RESPONSE,
|
||||
GEMINI,
|
||||
OpenaiResponse,
|
||||
Gemini,
|
||||
ConvertOpenAIResponsesRequestToGemini,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertGeminiResponseToOpenAIResponses,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
CLAUDE,
|
||||
OPENAI,
|
||||
Claude,
|
||||
OpenAI,
|
||||
ConvertClaudeRequestToOpenAI,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertOpenAIResponseToClaude,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINICLI,
|
||||
OPENAI,
|
||||
GeminiCLI,
|
||||
OpenAI,
|
||||
ConvertGeminiCLIRequestToOpenAI,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertOpenAIResponseToGeminiCLI,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
GEMINI,
|
||||
OPENAI,
|
||||
Gemini,
|
||||
OpenAI,
|
||||
ConvertGeminiRequestToOpenAI,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertOpenAIResponseToGemini,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI,
|
||||
OPENAI,
|
||||
OpenAI,
|
||||
OpenAI,
|
||||
ConvertOpenAIRequestToOpenAI,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertOpenAIResponseToOpenAI,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI_RESPONSE,
|
||||
OPENAI,
|
||||
OpenaiResponse,
|
||||
OpenAI,
|
||||
ConvertOpenAIResponsesRequestToOpenAIChatCompletions,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertOpenAIChatCompletionsResponseToOpenAIResponses,
|
||||
|
||||
Reference in New Issue
Block a user