mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-19 22:53:41 +08:00
- 添加Anthropic适配器实现 | Add Anthropic adaptor implementation - 支持Anthropic消息格式转换 | Support Anthropic message format conversion - 添加Vertex AI Claude适配器支持 | Add Vertex AI Claude adapter support - 更新Anthropic的中继模式定义 | Update relay mode definitions for Anthropic - 添加Anthropic控制器和路由 | Add Anthropic controller and routing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: zgdmemail@gmail.com
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package relaymode
|
|
|
|
import "strings"
|
|
|
|
func GetByPath(path string) int {
|
|
relayMode := Unknown
|
|
if strings.HasPrefix(path, "/v1/chat/completions") {
|
|
relayMode = ChatCompletions
|
|
} else if strings.HasPrefix(path, "/v1/completions") {
|
|
relayMode = Completions
|
|
} else if strings.HasPrefix(path, "/v1/embeddings") {
|
|
relayMode = Embeddings
|
|
} else if strings.HasSuffix(path, "embeddings") {
|
|
relayMode = Embeddings
|
|
} else if strings.HasPrefix(path, "/v1/moderations") {
|
|
relayMode = Moderations
|
|
} else if strings.HasPrefix(path, "/v1/images/generations") {
|
|
relayMode = ImagesGenerations
|
|
} else if strings.HasPrefix(path, "/v1/edits") {
|
|
relayMode = Edits
|
|
} else if strings.HasPrefix(path, "/v1/audio/speech") {
|
|
relayMode = AudioSpeech
|
|
} else if strings.HasPrefix(path, "/v1/audio/transcriptions") {
|
|
relayMode = AudioTranscription
|
|
} else if strings.HasPrefix(path, "/v1/audio/translations") {
|
|
relayMode = AudioTranslation
|
|
} else if strings.HasPrefix(path, "/v1/oneapi/proxy") {
|
|
relayMode = Proxy
|
|
} else if strings.HasPrefix(path, "/anthropic/v1/messages") {
|
|
relayMode = AnthropicMessages
|
|
}
|
|
return relayMode
|
|
}
|