Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
85fd1e4a
Commit
85fd1e4a
authored
Dec 25, 2025
by
ianshaw
Browse files
fix(backend): 移除对已删除 ports 包的依赖
适配 main 分支的 ports 目录删除重构: - 将 ports 包中的接口移至 service 包 - 更新 repository 层的导入路径
parent
6682d06c
Changes
9
Hide whitespace changes
Inline
Side-by-side
backend/internal/repository/gemini_oauth_client.go
View file @
85fd1e4a
...
...
@@ -8,7 +8,7 @@ import (
"github.com/Wei-Shaw/sub2api/internal/config"
"github.com/Wei-Shaw/sub2api/internal/pkg/geminicli"
"github.com/Wei-Shaw/sub2api/internal/service
/ports
"
"github.com/Wei-Shaw/sub2api/internal/service"
"github.com/imroc/req/v3"
)
...
...
@@ -18,7 +18,7 @@ type geminiOAuthClient struct {
cfg
*
config
.
Config
}
func
NewGeminiOAuthClient
(
cfg
*
config
.
Config
)
ports
.
GeminiOAuthClient
{
func
NewGeminiOAuthClient
(
cfg
*
config
.
Config
)
service
.
GeminiOAuthClient
{
return
&
geminiOAuthClient
{
tokenURL
:
geminicli
.
TokenURL
,
cfg
:
cfg
,
...
...
backend/internal/repository/gemini_token_cache.go
View file @
85fd1e4a
...
...
@@ -5,7 +5,7 @@ import (
"fmt"
"time"
"github.com/Wei-Shaw/sub2api/internal/service
/ports
"
"github.com/Wei-Shaw/sub2api/internal/service"
"github.com/redis/go-redis/v9"
)
...
...
@@ -19,7 +19,7 @@ type geminiTokenCache struct {
rdb
*
redis
.
Client
}
func
NewGeminiTokenCache
(
rdb
*
redis
.
Client
)
ports
.
GeminiTokenCache
{
func
NewGeminiTokenCache
(
rdb
*
redis
.
Client
)
service
.
GeminiTokenCache
{
return
&
geminiTokenCache
{
rdb
:
rdb
}
}
...
...
backend/internal/repository/geminicli_codeassist_client.go
View file @
85fd1e4a
...
...
@@ -6,7 +6,7 @@ import (
"time"
"github.com/Wei-Shaw/sub2api/internal/pkg/geminicli"
"github.com/Wei-Shaw/sub2api/internal/service
/ports
"
"github.com/Wei-Shaw/sub2api/internal/service"
"github.com/imroc/req/v3"
)
...
...
@@ -15,7 +15,7 @@ type geminiCliCodeAssistClient struct {
baseURL
string
}
func
NewGeminiCliCodeAssistClient
()
ports
.
GeminiCliCodeAssistClient
{
func
NewGeminiCliCodeAssistClient
()
service
.
GeminiCliCodeAssistClient
{
return
&
geminiCliCodeAssistClient
{
baseURL
:
geminicli
.
GeminiCliBaseURL
}
}
...
...
backend/internal/service/gemini_messages_compat_service.go
View file @
85fd1e4a
...
...
@@ -21,7 +21,6 @@ import (
"github.com/Wei-Shaw/sub2api/internal/model"
"github.com/Wei-Shaw/sub2api/internal/pkg/geminicli"
"github.com/Wei-Shaw/sub2api/internal/pkg/googleapi"
"github.com/Wei-Shaw/sub2api/internal/service/ports"
"github.com/gin-gonic/gin"
)
...
...
@@ -35,19 +34,19 @@ const (
)
type
GeminiMessagesCompatService
struct
{
accountRepo
ports
.
AccountRepository
cache
ports
.
GatewayCache
accountRepo
AccountRepository
cache
GatewayCache
tokenProvider
*
GeminiTokenProvider
rateLimitService
*
RateLimitService
httpUpstream
ports
.
HTTPUpstream
httpUpstream
HTTPUpstream
}
func
NewGeminiMessagesCompatService
(
accountRepo
ports
.
AccountRepository
,
cache
ports
.
GatewayCache
,
accountRepo
AccountRepository
,
cache
GatewayCache
,
tokenProvider
*
GeminiTokenProvider
,
rateLimitService
*
RateLimitService
,
httpUpstream
ports
.
HTTPUpstream
,
httpUpstream
HTTPUpstream
,
)
*
GeminiMessagesCompatService
{
return
&
GeminiMessagesCompatService
{
accountRepo
:
accountRepo
,
...
...
backend/internal/service/gemini_oauth.go
View file @
85fd1e4a
package
ports
package
service
import
(
"context"
...
...
backend/internal/service/gemini_oauth_service.go
View file @
85fd1e4a
...
...
@@ -15,21 +15,20 @@ import (
"github.com/Wei-Shaw/sub2api/internal/config"
"github.com/Wei-Shaw/sub2api/internal/model"
"github.com/Wei-Shaw/sub2api/internal/pkg/geminicli"
"github.com/Wei-Shaw/sub2api/internal/service/ports"
)
type
GeminiOAuthService
struct
{
sessionStore
*
geminicli
.
SessionStore
proxyRepo
ports
.
ProxyRepository
oauthClient
ports
.
GeminiOAuthClient
codeAssist
ports
.
GeminiCliCodeAssistClient
proxyRepo
ProxyRepository
oauthClient
GeminiOAuthClient
codeAssist
GeminiCliCodeAssistClient
cfg
*
config
.
Config
}
func
NewGeminiOAuthService
(
proxyRepo
ports
.
ProxyRepository
,
oauthClient
ports
.
GeminiOAuthClient
,
codeAssist
ports
.
GeminiCliCodeAssistClient
,
proxyRepo
ProxyRepository
,
oauthClient
GeminiOAuthClient
,
codeAssist
GeminiCliCodeAssistClient
,
cfg
*
config
.
Config
,
)
*
GeminiOAuthService
{
return
&
GeminiOAuthService
{
...
...
backend/internal/service/gemini_token_cache.go
View file @
85fd1e4a
package
ports
package
service
import
(
"context"
...
...
backend/internal/service/gemini_token_provider.go
View file @
85fd1e4a
...
...
@@ -9,7 +9,6 @@ import (
"time"
"github.com/Wei-Shaw/sub2api/internal/model"
"github.com/Wei-Shaw/sub2api/internal/service/ports"
)
const
(
...
...
@@ -18,14 +17,14 @@ const (
)
type
GeminiTokenProvider
struct
{
accountRepo
ports
.
AccountRepository
tokenCache
ports
.
GeminiTokenCache
accountRepo
AccountRepository
tokenCache
GeminiTokenCache
geminiOAuthService
*
GeminiOAuthService
}
func
NewGeminiTokenProvider
(
accountRepo
ports
.
AccountRepository
,
tokenCache
ports
.
GeminiTokenCache
,
accountRepo
AccountRepository
,
tokenCache
GeminiTokenCache
,
geminiOAuthService
*
GeminiOAuthService
,
)
*
GeminiTokenProvider
{
return
&
GeminiTokenProvider
{
...
...
backend/internal/service/geminicli_codeassist.go
View file @
85fd1e4a
package
ports
package
service
import
(
"context"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment