mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-10-14 23:00:27 +00:00
feat: support gemini-2.0-flash (#2055)
* feat: support gemini-2.0-flash - Enhance model support by adding new entries and refining checks for system instruction compatibility. - Update logging display behavior and adjust default quotas for better user experience. - Revamp pricing structures in the billing system to reflect current model values and deprecate outdated entries. - Streamline code by replacing hardcoded values with configurations for maintainability. * feat: add new Gemini 2.0 flash models to adapter and billing ratio * fix: update GetRequestURL to support gemini-1.5 model in versioning
This commit is contained in:
@@ -132,9 +132,16 @@ func ConvertRequest(textRequest model.GeneralOpenAIRequest) *ChatRequest {
|
||||
}
|
||||
// Converting system prompt to prompt from user for the same reason
|
||||
if content.Role == "system" {
|
||||
content.Role = "user"
|
||||
shouldAddDummyModelMessage = true
|
||||
if IsModelSupportSystemInstruction(textRequest.Model) {
|
||||
geminiRequest.SystemInstruction = &content
|
||||
geminiRequest.SystemInstruction.Role = ""
|
||||
continue
|
||||
} else {
|
||||
content.Role = "user"
|
||||
}
|
||||
}
|
||||
|
||||
geminiRequest.Contents = append(geminiRequest.Contents, content)
|
||||
|
||||
// If a system message is the last message, we need to add a dummy model message to make gemini happy
|
||||
|
Reference in New Issue
Block a user