mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-18 01:26:37 +08:00
- Improve error handling across multiple middleware and adapter components, ensuring consistent error response formats in JSON. - Enhance the functionality of request conversion functions by including context parameters and robust error wrapping. - Introduce new features related to reasoning content in the messaging model, providing better customization and explanations in the documentation.
24 lines
636 B
Go
24 lines
636 B
Go
package doubao
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/songquanpeng/one-api/relay/meta"
|
|
"github.com/songquanpeng/one-api/relay/relaymode"
|
|
)
|
|
|
|
func GetRequestURL(meta *meta.Meta) (string, error) {
|
|
switch meta.Mode {
|
|
case relaymode.ChatCompletions:
|
|
if strings.HasPrefix(meta.ActualModelName, "bot") {
|
|
return fmt.Sprintf("%s/api/v3/bots/chat/completions", meta.BaseURL), nil
|
|
}
|
|
return fmt.Sprintf("%s/api/v3/chat/completions", meta.BaseURL), nil
|
|
case relaymode.Embeddings:
|
|
return fmt.Sprintf("%s/api/v3/embeddings", meta.BaseURL), nil
|
|
default:
|
|
}
|
|
return "", fmt.Errorf("unsupported relay mode %d for doubao", meta.Mode)
|
|
}
|