mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
Refactor translator packages for OpenAI Chat Completions
- Renamed `openai` packages to `chat_completions` across translator modules. - Introduced `openai_responses_handlers` with handlers for `/v1/models` and OpenAI-compatible chat completions endpoints. - Updated constants and registry identifiers for OpenAI response type. - Simplified request/response conversions and added detailed retry/error handling. - Added `golang.org/x/crypto` for additional cryptographic functions.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
package responses
|
||||
|
||||
func ConvertOpenAIResponsesRequestToClaude(modelName string, rawJSON []byte, stream bool) []byte {
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package responses
|
||||
|
||||
import "context"
|
||||
|
||||
func ConvertClaudeResponseToOpenAIResponses(_ context.Context, modelName string, rawJSON []byte, param *any) []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func ConvertClaudeResponseToOpenAIResponsesNonStream(_ context.Context, _ string, rawJSON []byte, _ *any) string {
|
||||
return ""
|
||||
}
|
||||
19
internal/translator/claude/openai/responses/init.go
Normal file
19
internal/translator/claude/openai/responses/init.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package responses
|
||||
|
||||
import (
|
||||
. "github.com/luispater/CLIProxyAPI/internal/constant"
|
||||
"github.com/luispater/CLIProxyAPI/internal/interfaces"
|
||||
"github.com/luispater/CLIProxyAPI/internal/translator/translator"
|
||||
)
|
||||
|
||||
func init() {
|
||||
translator.Register(
|
||||
OPENAI_RESPONSE,
|
||||
CLAUDE,
|
||||
ConvertOpenAIResponsesRequestToClaude,
|
||||
interfaces.TranslateResponse{
|
||||
Stream: ConvertClaudeResponseToOpenAIResponses,
|
||||
NonStream: ConvertClaudeResponseToOpenAIResponsesNonStream,
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user