mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-05 00:45:29 +08:00
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package gemini
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"ds2api/internal/auth"
|
|
"ds2api/internal/config"
|
|
dsclient "ds2api/internal/deepseek/client"
|
|
)
|
|
|
|
type AuthResolver interface {
|
|
Determine(req *http.Request) (*auth.RequestAuth, error)
|
|
Release(a *auth.RequestAuth)
|
|
}
|
|
|
|
type DeepSeekCaller interface {
|
|
CreateSession(ctx context.Context, a *auth.RequestAuth, maxAttempts int) (string, error)
|
|
GetPow(ctx context.Context, a *auth.RequestAuth, maxAttempts int) (string, error)
|
|
UploadFile(ctx context.Context, a *auth.RequestAuth, req dsclient.UploadFileRequest, maxAttempts int) (*dsclient.UploadFileResult, error)
|
|
CallCompletion(ctx context.Context, a *auth.RequestAuth, payload map[string]any, powResp string, maxAttempts int) (*http.Response, error)
|
|
}
|
|
|
|
type ConfigReader interface {
|
|
ModelAliases() map[string]string
|
|
CurrentInputFileEnabled() bool
|
|
CurrentInputFileMinChars() int
|
|
}
|
|
|
|
type OpenAIChatRunner interface {
|
|
ChatCompletions(w http.ResponseWriter, r *http.Request)
|
|
}
|
|
|
|
var _ AuthResolver = (*auth.Resolver)(nil)
|
|
var _ DeepSeekCaller = (*dsclient.Client)(nil)
|
|
var _ ConfigReader = (*config.Store)(nil)
|