provider

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// QwenPortalModelCoder is the model used for coding tasks in the portal.
	QwenPortalModelCoder = "coder-model"

	// QwenPortalModelVision is the multimodal model used in the portal.
	QwenPortalModelVision = "vision-model"

	// QwenPortalDailyLimit represents the undocumented daily request limit.
	QwenPortalDailyLimit = 2000
)

Undocumented Qwen Portal Constants discovered via testing

Variables

This section is empty.

Functions

This section is empty.

Types

type GeminiProvider

type GeminiProvider struct {
	ClientID     string
	ClientSecret string
	CallbackURL  string // 例如: http://localhost:8080/oauth2/callback
	ListenAddr   string // 例如: ":8080"
	HTTPClient   *http.Client
	TokenURL     string // For testing override
}

GeminiProvider Gemini 提供商 (标准 OAuth2 Authorization Code Flow)

func NewGeminiProvider

func NewGeminiProvider(clientID, clientSecret, callbackURL, listenAddr string) *GeminiProvider

NewGeminiProvider 创建 Gemini 提供商

func (*GeminiProvider) Authenticate

func (p *GeminiProvider) Authenticate() (*core.OAuthToken, error)

Authenticate 执行标准 OAuth2 授权码流程

func (*GeminiProvider) GetProviderName

func (p *GeminiProvider) GetProviderName() string

GetProviderName 获取提供商名称

func (*GeminiProvider) RefreshToken

func (p *GeminiProvider) RefreshToken(refreshToken string) (*core.OAuthToken, error)

RefreshToken 刷新令牌

type MiniMaxOAuthAuthorization

type MiniMaxOAuthAuthorization struct {
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiredIn       int    `json:"expired_in"`
	Interval        int    `json:"interval,omitempty"`
	State           string `json:"state"`
}

MiniMaxOAuthAuthorization MiniMax OAuth 授权响应

type MiniMaxProvider

type MiniMaxProvider struct {
	HTTPClient    *http.Client
	TokenHelper   *core.TokenHelper
	PKCEHelper    *core.PKCEHelper
	Region        string
	BaseURL       string
	ClientID      string
	OAuthCodeURL  string // For testing override
	OAuthTokenURL string // For testing override
}

MiniMaxProvider MiniMax 提供商

func NewMiniMaxProvider

func NewMiniMaxProvider(region string) *MiniMaxProvider

NewMiniMaxProvider 创建 MiniMax 提供商

func (*MiniMaxProvider) Authenticate

func (p *MiniMaxProvider) Authenticate() (*core.OAuthToken, error)

Authenticate 执行认证流程

func (*MiniMaxProvider) GetProviderName

func (p *MiniMaxProvider) GetProviderName() string

GetProviderName 获取提供商名称

func (*MiniMaxProvider) PollOAuthToken

func (p *MiniMaxProvider) PollOAuthToken(userCode, verifier string) (status string, token *core.OAuthToken, errorMsg string)

PollOAuthToken 轮询 OAuth 令牌

func (*MiniMaxProvider) RefreshToken

func (p *MiniMaxProvider) RefreshToken(refreshToken string) (*core.OAuthToken, error)

RefreshToken 刷新令牌

func (*MiniMaxProvider) RequestOAuthCode

func (p *MiniMaxProvider) RequestOAuthCode() (*MiniMaxOAuthAuthorization, string, string, error)

RequestOAuthCode 请求 OAuth 授权码

type QwenDeviceAuthorization

type QwenDeviceAuthorization struct {
	DeviceCode              string `json:"device_code"`
	UserCode                string `json:"user_code"`
	VerificationURI         string `json:"verification_uri"`
	VerificationURIComplete string `json:"verification_uri_complete,omitempty"`
	ExpiresIn               int    `json:"expires_in"`
	Interval                int    `json:"interval,omitempty"`
}

QwenDeviceAuthorization Qwen 设备授权响应

type QwenProvider

type QwenProvider struct {
	HTTPClient    *http.Client
	TokenHelper   *core.TokenHelper
	PKCEHelper    *core.PKCEHelper
	DeviceCodeURL string // For testing override
	TokenURL      string // For testing override
}

QwenProvider Qwen 提供商

func NewQwenProvider

func NewQwenProvider() *QwenProvider

NewQwenProvider 创建 Qwen 提供商

func (*QwenProvider) Authenticate

func (p *QwenProvider) Authenticate() (*core.OAuthToken, error)

Authenticate 执行认证流程

func (*QwenProvider) GetProviderName

func (p *QwenProvider) GetProviderName() string

GetProviderName 获取提供商名称

func (*QwenProvider) PollForToken

func (p *QwenProvider) PollForToken(deviceCode, verifier string) (status string, token *core.OAuthToken, slowDown bool, errorMsg string)

PollForToken 轮询获取令牌

func (*QwenProvider) RefreshToken

func (p *QwenProvider) RefreshToken(refreshToken string) (*core.OAuthToken, error)

RefreshToken 刷新令牌

func (*QwenProvider) RequestDeviceCode

func (p *QwenProvider) RequestDeviceCode() (*QwenDeviceAuthorization, string, error)

RequestDeviceCode 请求设备码

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL