feat(backend): 添加 Gemini/Google API 基础包
- 新增 pkg/gemini: 模型定义与回退列表 - 新增 pkg/googleapi: Google API 错误状态处理 - 新增 pkg/geminicli/models.go: CLI 模型结构 - 更新 constants.go: AI Studio 相关常量 - 更新 oauth.go: 支持 AI Studio OAuth 流程,凭据通过环境变量配置
This commit is contained in:
22
backend/internal/pkg/geminicli/models.go
Normal file
22
backend/internal/pkg/geminicli/models.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package geminicli
|
||||
|
||||
// Model represents a selectable Gemini model for UI/testing purposes.
|
||||
// Keep JSON fields consistent with existing frontend expectations.
|
||||
type Model struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
DisplayName string `json:"display_name"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
// DefaultModels is the curated Gemini model list used by the admin UI "test account" flow.
|
||||
var DefaultModels = []Model{
|
||||
{ID: "gemini-3-pro", Type: "model", DisplayName: "Gemini 3 Pro", CreatedAt: ""},
|
||||
{ID: "gemini-3-flash", Type: "model", DisplayName: "Gemini 3 Flash", CreatedAt: ""},
|
||||
{ID: "gemini-2.5-pro", Type: "model", DisplayName: "Gemini 2.5 Pro", CreatedAt: ""},
|
||||
{ID: "gemini-2.5-flash", Type: "model", DisplayName: "Gemini 2.5 Flash", CreatedAt: ""},
|
||||
}
|
||||
|
||||
// DefaultTestModel is the default model to preselect in test flows.
|
||||
const DefaultTestModel = "gemini-2.5-pro"
|
||||
|
||||
Reference in New Issue
Block a user