diff --git a/.github/workflows/electron-build.yml b/.github/workflows/electron-build.yml index 285bc4bb0..c10b192f0 100644 --- a/.github/workflows/electron-build.yml +++ b/.github/workflows/electron-build.yml @@ -53,13 +53,13 @@ jobs: # if: runner.os != 'Windows' # run: | # go mod download - # go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o new-api + # go build -ldflags "-s -w -X 'new-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o new-api - name: Build Go binary (Windows) if: runner.os == 'Windows' run: | go mod download - go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)'" -o new-api.exe + go build -ldflags "-s -w -X 'new-api/common.Version=$(git describe --tags)'" -o new-api.exe - name: Update Electron version run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f7df84e2..badfefa06 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,13 +41,13 @@ jobs: run: | go mod download VERSION=$(git describe --tags) - go build -ldflags "-s -w -X 'one-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-$VERSION + go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-$VERSION - name: Build Backend (arm64) run: | sudo apt-get update DEBIAN_FRONTEND=noninteractive sudo apt-get install -y gcc-aarch64-linux-gnu VERSION=$(git describe --tags) - CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'one-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-arm64-$VERSION + CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-arm64-$VERSION - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') @@ -87,7 +87,7 @@ jobs: run: | go mod download VERSION=$(git describe --tags) - go build -ldflags "-X 'one-api/common.Version=$VERSION'" -o new-api-macos-$VERSION + go build -ldflags "-X 'new-api/common.Version=$VERSION'" -o new-api-macos-$VERSION - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') @@ -128,7 +128,7 @@ jobs: run: | go mod download VERSION=$(git describe --tags) - go build -ldflags "-s -w -X 'one-api/common.Version=$VERSION'" -o new-api-$VERSION.exe + go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION'" -o new-api-$VERSION.exe - name: Release uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') diff --git a/Dockerfile b/Dockerfile index fb4cbbc36..8d835697c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN go mod download COPY . . COPY --from=builder /build/dist ./web/dist -RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)'" -o one-api +RUN go build -ldflags "-s -w -X 'new-api/common.Version=$(cat VERSION)'" -o new-api FROM alpine @@ -31,7 +31,7 @@ RUN apk upgrade --no-cache \ && apk add --no-cache ca-certificates tzdata ffmpeg \ && update-ca-certificates -COPY --from=builder2 /build/one-api / +COPY --from=builder2 /build/new-api / EXPOSE 3000 WORKDIR /data -ENTRYPOINT ["/one-api"] +ENTRYPOINT ["/new-api"] diff --git a/common/api_type.go b/common/api_type.go index 855eef84f..6d7a70529 100644 --- a/common/api_type.go +++ b/common/api_type.go @@ -1,6 +1,6 @@ package common -import "one-api/constant" +import "github.com/QuantumNous/new-api/constant" func ChannelType2APIType(channelType int) (int, bool) { apiType := -1 diff --git a/common/crypto.go b/common/crypto.go index c353188aa..3ca06bd2d 100644 --- a/common/crypto.go +++ b/common/crypto.go @@ -4,6 +4,7 @@ import ( "crypto/hmac" "crypto/sha256" "encoding/hex" + "golang.org/x/crypto/bcrypt" ) diff --git a/common/embed-file-system.go b/common/embed-file-system.go index 3ea02cf81..d7bd2d5bd 100644 --- a/common/embed-file-system.go +++ b/common/embed-file-system.go @@ -2,9 +2,10 @@ package common import ( "embed" - "github.com/gin-contrib/static" "io/fs" "net/http" + + "github.com/gin-contrib/static" ) // Credit: https://github.com/gin-contrib/static/issues/19 diff --git a/common/endpoint_defaults.go b/common/endpoint_defaults.go index 25f9c68eb..c04c5f6d8 100644 --- a/common/endpoint_defaults.go +++ b/common/endpoint_defaults.go @@ -1,6 +1,6 @@ package common -import "one-api/constant" +import "github.com/QuantumNous/new-api/constant" // EndpointInfo 描述单个端点的默认请求信息 // path: 上游路径 diff --git a/common/endpoint_type.go b/common/endpoint_type.go index a0ca73ead..bc1209449 100644 --- a/common/endpoint_type.go +++ b/common/endpoint_type.go @@ -1,6 +1,6 @@ package common -import "one-api/constant" +import "github.com/QuantumNous/new-api/constant" // GetEndpointTypesByChannelType 获取渠道最优先端点类型(所有的渠道都支持 OpenAI 端点) func GetEndpointTypesByChannelType(channelType int, modelName string) []constant.EndpointType { diff --git a/common/gin.go b/common/gin.go index 91a3a441a..4bc9f1ba7 100644 --- a/common/gin.go +++ b/common/gin.go @@ -5,10 +5,11 @@ import ( "io" "mime/multipart" "net/http" - "one-api/constant" "strings" "time" + "github.com/QuantumNous/new-api/constant" + "github.com/gin-gonic/gin" ) diff --git a/common/gopool.go b/common/gopool.go index bf5df3119..d410380b8 100644 --- a/common/gopool.go +++ b/common/gopool.go @@ -3,8 +3,9 @@ package common import ( "context" "fmt" - "github.com/bytedance/gopkg/util/gopool" "math" + + "github.com/bytedance/gopkg/util/gopool" ) var relayGoPool gopool.Pool diff --git a/common/init.go b/common/init.go index c4626f9ae..c3db9dd32 100644 --- a/common/init.go +++ b/common/init.go @@ -4,11 +4,12 @@ import ( "flag" "fmt" "log" - "one-api/constant" "os" "path/filepath" "strconv" "time" + + "github.com/QuantumNous/new-api/constant" ) var ( @@ -19,10 +20,10 @@ var ( ) func printHelp() { - fmt.Println("New API " + Version + " - All in one API service for OpenAI API.") - fmt.Println("Copyright (C) 2023 JustSong. All rights reserved.") - fmt.Println("GitHub: https://github.com/songquanpeng/one-api") - fmt.Println("Usage: one-api [--port ] [--log-dir ] [--version] [--help]") + fmt.Println("NewAPI(Based OneAPI) " + Version + " - The next-generation LLM gateway and AI asset management system supports multiple languages.") + fmt.Println("Original Project: OneAPI by JustSong - https://github.com/songquanpeng/one-api") + fmt.Println("Maintainer: QuantumNous - https://github.com/QuantumNous/new-api") + fmt.Println("Usage: newapi [--port ] [--log-dir ] [--version] [--help]") } func InitEnv() { diff --git a/common/limiter/limiter.go b/common/limiter/limiter.go index ef5d1935a..6be61bc95 100644 --- a/common/limiter/limiter.go +++ b/common/limiter/limiter.go @@ -4,9 +4,10 @@ import ( "context" _ "embed" "fmt" - "github.com/go-redis/redis/v8" - "one-api/common" "sync" + + "github.com/QuantumNous/new-api/common" + "github.com/go-redis/redis/v8" ) //go:embed lua/rate_limit.lua diff --git a/common/pprof.go b/common/pprof.go index 4bec30f15..745926536 100644 --- a/common/pprof.go +++ b/common/pprof.go @@ -2,10 +2,11 @@ package common import ( "fmt" - "github.com/shirou/gopsutil/cpu" "os" "runtime/pprof" "time" + + "github.com/shirou/gopsutil/cpu" ) // Monitor 定时监控cpu使用率,超过阈值输出pprof文件 diff --git a/common/verification.go b/common/verification.go index d8ccd6eaf..41fd3c943 100644 --- a/common/verification.go +++ b/common/verification.go @@ -1,10 +1,11 @@ package common import ( - "github.com/google/uuid" "strings" "sync" "time" + + "github.com/google/uuid" ) type verificationValue struct { diff --git a/controller/billing.go b/controller/billing.go index db3b62b1e..1c92a2507 100644 --- a/controller/billing.go +++ b/controller/billing.go @@ -1,11 +1,11 @@ package controller import ( + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting/operation_setting" "github.com/gin-gonic/gin" - "one-api/common" - "one-api/dto" - "one-api/model" - "one-api/setting/operation_setting" ) func GetSubscription(c *gin.Context) { diff --git a/controller/channel-billing.go b/controller/channel-billing.go index a7dfe9508..751ee3600 100644 --- a/controller/channel-billing.go +++ b/controller/channel-billing.go @@ -6,15 +6,16 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/model" - "one-api/service" - "one-api/setting/operation_setting" - "one-api/types" "strconv" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/types" + "github.com/shopspring/decimal" "github.com/gin-gonic/gin" diff --git a/controller/channel-test.go b/controller/channel-test.go index 5bbc20ebc..9942369df 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -10,23 +10,24 @@ import ( "net/http" "net/http/httptest" "net/url" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/middleware" - "one-api/model" - "one-api/relay" - relaycommon "one-api/relay/common" - relayconstant "one-api/relay/constant" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/operation_setting" - "one-api/types" "strconv" "strings" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/middleware" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay" + relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/types" + "github.com/bytedance/gopkg/util/gopool" "github.com/samber/lo" diff --git a/controller/channel.go b/controller/channel.go index 24cfa02df..eba990955 100644 --- a/controller/channel.go +++ b/controller/channel.go @@ -4,14 +4,15 @@ import ( "encoding/json" "fmt" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/model" - "one-api/service" "strconv" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/service" + "github.com/gin-gonic/gin" ) diff --git a/controller/console_migrate.go b/controller/console_migrate.go index f0812c3d6..011ab09d4 100644 --- a/controller/console_migrate.go +++ b/controller/console_migrate.go @@ -5,8 +5,9 @@ package controller import ( "encoding/json" "net/http" - "one-api/common" - "one-api/model" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" "github.com/gin-gonic/gin" ) diff --git a/controller/github.go b/controller/github.go index 881d6dc16..7097356db 100644 --- a/controller/github.go +++ b/controller/github.go @@ -6,11 +6,12 @@ import ( "errors" "fmt" "net/http" - "one-api/common" - "one-api/model" "strconv" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) diff --git a/controller/group.go b/controller/group.go index 2565b6eae..3267818e0 100644 --- a/controller/group.go +++ b/controller/group.go @@ -2,9 +2,10 @@ package controller import ( "net/http" - "one-api/model" - "one-api/setting" - "one-api/setting/ratio_setting" + + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/ratio_setting" "github.com/gin-gonic/gin" ) diff --git a/controller/linuxdo.go b/controller/linuxdo.go index 9fa156157..051563b5c 100644 --- a/controller/linuxdo.go +++ b/controller/linuxdo.go @@ -7,12 +7,13 @@ import ( "fmt" "net/http" "net/url" - "one-api/common" - "one-api/model" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) diff --git a/controller/log.go b/controller/log.go index 042fa7253..da9bca468 100644 --- a/controller/log.go +++ b/controller/log.go @@ -2,10 +2,11 @@ package controller import ( "net/http" - "one-api/common" - "one-api/model" "strconv" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-gonic/gin" ) diff --git a/controller/midjourney.go b/controller/midjourney.go index 3a7304419..c480c12bb 100644 --- a/controller/midjourney.go +++ b/controller/midjourney.go @@ -7,15 +7,16 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - "one-api/model" - "one-api/service" - "one-api/setting" - "one-api/setting/system_setting" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/gin-gonic/gin" ) diff --git a/controller/misc.go b/controller/misc.go index 8654848d5..83b43fb57 100644 --- a/controller/misc.go +++ b/controller/misc.go @@ -4,16 +4,17 @@ import ( "encoding/json" "fmt" "net/http" - "one-api/common" - "one-api/constant" - "one-api/middleware" - "one-api/model" - "one-api/setting" - "one-api/setting/console_setting" - "one-api/setting/operation_setting" - "one-api/setting/system_setting" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/middleware" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/console_setting" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/gin-gonic/gin" ) diff --git a/controller/missing_models.go b/controller/missing_models.go index 425f9b25f..eddd8699d 100644 --- a/controller/missing_models.go +++ b/controller/missing_models.go @@ -2,7 +2,8 @@ package controller import ( "net/http" - "one-api/model" + + "github.com/QuantumNous/new-api/model" "github.com/gin-gonic/gin" ) diff --git a/controller/model.go b/controller/model.go index f0571b995..3ab890c4b 100644 --- a/controller/model.go +++ b/controller/model.go @@ -2,21 +2,22 @@ package controller import ( "fmt" + "net/http" + "time" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay" + "github.com/QuantumNous/new-api/relay/channel/ai360" + "github.com/QuantumNous/new-api/relay/channel/lingyiwanwu" + "github.com/QuantumNous/new-api/relay/channel/minimax" + "github.com/QuantumNous/new-api/relay/channel/moonshot" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/setting" "github.com/gin-gonic/gin" "github.com/samber/lo" - "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/model" - "one-api/relay" - "one-api/relay/channel/ai360" - "one-api/relay/channel/lingyiwanwu" - "one-api/relay/channel/minimax" - "one-api/relay/channel/moonshot" - relaycommon "one-api/relay/common" - "one-api/setting" - "time" ) // https://platform.openai.com/docs/api-reference/models/list diff --git a/controller/model_meta.go b/controller/model_meta.go index 31ea64f35..fd3626442 100644 --- a/controller/model_meta.go +++ b/controller/model_meta.go @@ -6,9 +6,9 @@ import ( "strconv" "strings" - "one-api/common" - "one-api/constant" - "one-api/model" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/model" "github.com/gin-gonic/gin" ) diff --git a/controller/model_sync.go b/controller/model_sync.go index 74034b51a..e321ee0c5 100644 --- a/controller/model_sync.go +++ b/controller/model_sync.go @@ -13,8 +13,8 @@ import ( "sync" "time" - "one-api/common" - "one-api/model" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" "github.com/gin-gonic/gin" "gorm.io/gorm" diff --git a/controller/oidc.go b/controller/oidc.go index 8e254d38f..ac49f84e1 100644 --- a/controller/oidc.go +++ b/controller/oidc.go @@ -6,13 +6,14 @@ import ( "fmt" "net/http" "net/url" - "one-api/common" - "one-api/model" - "one-api/setting/system_setting" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) diff --git a/controller/option.go b/controller/option.go index 7d1c676f5..56f65f5ff 100644 --- a/controller/option.go +++ b/controller/option.go @@ -4,14 +4,15 @@ import ( "encoding/json" "fmt" "net/http" - "one-api/common" - "one-api/model" - "one-api/setting" - "one-api/setting/console_setting" - "one-api/setting/ratio_setting" - "one-api/setting/system_setting" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/console_setting" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/gin-gonic/gin" ) diff --git a/controller/passkey.go b/controller/passkey.go index 7ffacf5d6..a2cc53699 100644 --- a/controller/passkey.go +++ b/controller/passkey.go @@ -7,10 +7,10 @@ import ( "strconv" "time" - "one-api/common" - "one-api/model" - passkeysvc "one-api/service/passkey" - "one-api/setting/system_setting" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + passkeysvc "github.com/QuantumNous/new-api/service/passkey" + "github.com/QuantumNous/new-api/setting/system_setting" "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" diff --git a/controller/playground.go b/controller/playground.go index 8a1cb2b67..f6e0953fc 100644 --- a/controller/playground.go +++ b/controller/playground.go @@ -3,13 +3,14 @@ package controller import ( "errors" "fmt" - "one-api/common" - "one-api/constant" - "one-api/middleware" - "one-api/model" - "one-api/types" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/middleware" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/controller/prefill_group.go b/controller/prefill_group.go index d912d6098..3c990daa0 100644 --- a/controller/prefill_group.go +++ b/controller/prefill_group.go @@ -3,8 +3,8 @@ package controller import ( "strconv" - "one-api/common" - "one-api/model" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" "github.com/gin-gonic/gin" ) diff --git a/controller/pricing.go b/controller/pricing.go index 4b7cc86d5..e1edd1b66 100644 --- a/controller/pricing.go +++ b/controller/pricing.go @@ -1,9 +1,9 @@ package controller import ( - "one-api/model" - "one-api/setting" - "one-api/setting/ratio_setting" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/ratio_setting" "github.com/gin-gonic/gin" ) diff --git a/controller/ratio_config.go b/controller/ratio_config.go index 0cb4aa73b..b9b9d479a 100644 --- a/controller/ratio_config.go +++ b/controller/ratio_config.go @@ -2,7 +2,8 @@ package controller import ( "net/http" - "one-api/setting/ratio_setting" + + "github.com/QuantumNous/new-api/setting/ratio_setting" "github.com/gin-gonic/gin" ) diff --git a/controller/ratio_sync.go b/controller/ratio_sync.go index 7a481c476..b8224b816 100644 --- a/controller/ratio_sync.go +++ b/controller/ratio_sync.go @@ -7,14 +7,15 @@ import ( "io" "net" "net/http" - "one-api/logger" "strings" "sync" "time" - "one-api/dto" - "one-api/model" - "one-api/setting/ratio_setting" + "github.com/QuantumNous/new-api/logger" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting/ratio_setting" "github.com/gin-gonic/gin" ) diff --git a/controller/redemption.go b/controller/redemption.go index 1e305e3d8..945cefa35 100644 --- a/controller/redemption.go +++ b/controller/redemption.go @@ -3,11 +3,12 @@ package controller import ( "errors" "net/http" - "one-api/common" - "one-api/model" "strconv" "unicode/utf8" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-gonic/gin" ) diff --git a/controller/relay.go b/controller/relay.go index 23d725153..27ece2872 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -6,21 +6,22 @@ import ( "io" "log" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/logger" - "one-api/middleware" - "one-api/model" - "one-api/relay" - relaycommon "one-api/relay/common" - relayconstant "one-api/relay/constant" - "one-api/relay/helper" - "one-api/service" - "one-api/setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/middleware" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay" + relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/types" + "github.com/bytedance/gopkg/util/gopool" "github.com/gin-gonic/gin" diff --git a/controller/secure_verification.go b/controller/secure_verification.go index 1c5f0981a..f30c259e6 100644 --- a/controller/secure_verification.go +++ b/controller/secure_verification.go @@ -3,12 +3,13 @@ package controller import ( "fmt" "net/http" - "one-api/common" - "one-api/model" - passkeysvc "one-api/service/passkey" - "one-api/setting/system_setting" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + passkeysvc "github.com/QuantumNous/new-api/service/passkey" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) diff --git a/controller/setup.go b/controller/setup.go index 8b7fa3e7a..2f6a0c9be 100644 --- a/controller/setup.go +++ b/controller/setup.go @@ -1,12 +1,13 @@ package controller import ( - "github.com/gin-gonic/gin" - "one-api/common" - "one-api/constant" - "one-api/model" - "one-api/setting/operation_setting" "time" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/gin-gonic/gin" ) type Setup struct { diff --git a/controller/task.go b/controller/task.go index 1082d7a11..c14d7e21d 100644 --- a/controller/task.go +++ b/controller/task.go @@ -7,16 +7,17 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/logger" - "one-api/model" - "one-api/relay" "sort" "strconv" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay" + "github.com/gin-gonic/gin" "github.com/samber/lo" ) diff --git a/controller/task_video.go b/controller/task_video.go index 8d4acdda8..50fc8d6d9 100644 --- a/controller/task_video.go +++ b/controller/task_video.go @@ -5,16 +5,17 @@ import ( "encoding/json" "fmt" "io" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/logger" - "one-api/model" - "one-api/relay" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/setting/ratio_setting" "time" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/setting/ratio_setting" ) func UpdateVideoTaskAll(ctx context.Context, platform constant.TaskPlatform, taskChannelM map[int][]string, taskM map[string]*model.Task) error { diff --git a/controller/telegram.go b/controller/telegram.go index 2b1ec4fcf..f16cdd66c 100644 --- a/controller/telegram.go +++ b/controller/telegram.go @@ -6,10 +6,11 @@ import ( "encoding/hex" "io" "net/http" - "one-api/common" - "one-api/model" "sort" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) diff --git a/controller/token.go b/controller/token.go index 8ed8b9570..04e31f8c1 100644 --- a/controller/token.go +++ b/controller/token.go @@ -2,11 +2,12 @@ package controller import ( "net/http" - "one-api/common" - "one-api/model" "strconv" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-gonic/gin" ) diff --git a/controller/topup.go b/controller/topup.go index 62bc676da..26d653606 100644 --- a/controller/topup.go +++ b/controller/topup.go @@ -4,17 +4,18 @@ import ( "fmt" "log" "net/url" - "one-api/common" - "one-api/logger" - "one-api/model" - "one-api/service" - "one-api/setting" - "one-api/setting/operation_setting" - "one-api/setting/system_setting" "strconv" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/Calcium-Ion/go-epay/epay" "github.com/gin-gonic/gin" "github.com/samber/lo" diff --git a/controller/topup_stripe.go b/controller/topup_stripe.go index a4bdf064d..75dbe28b4 100644 --- a/controller/topup_stripe.go +++ b/controller/topup_stripe.go @@ -5,15 +5,16 @@ import ( "io" "log" "net/http" - "one-api/common" - "one-api/model" - "one-api/setting" - "one-api/setting/operation_setting" - "one-api/setting/system_setting" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/gin-gonic/gin" "github.com/stripe/stripe-go/v81" "github.com/stripe/stripe-go/v81/checkout/session" diff --git a/controller/twofa.go b/controller/twofa.go index 1859a1284..556c07e9e 100644 --- a/controller/twofa.go +++ b/controller/twofa.go @@ -4,10 +4,11 @@ import ( "errors" "fmt" "net/http" - "one-api/common" - "one-api/model" "strconv" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) diff --git a/controller/uptime_kuma.go b/controller/uptime_kuma.go index 41b9695c3..2beceb426 100644 --- a/controller/uptime_kuma.go +++ b/controller/uptime_kuma.go @@ -5,11 +5,12 @@ import ( "encoding/json" "errors" "net/http" - "one-api/setting/console_setting" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/setting/console_setting" + "github.com/gin-gonic/gin" "golang.org/x/sync/errgroup" ) diff --git a/controller/usedata.go b/controller/usedata.go index 4adee50f7..816988a2b 100644 --- a/controller/usedata.go +++ b/controller/usedata.go @@ -2,10 +2,11 @@ package controller import ( "net/http" - "one-api/common" - "one-api/model" "strconv" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-gonic/gin" ) diff --git a/controller/user.go b/controller/user.go index 33d4636b7..4418548a8 100644 --- a/controller/user.go +++ b/controller/user.go @@ -5,16 +5,17 @@ import ( "fmt" "net/http" "net/url" - "one-api/common" - "one-api/dto" - "one-api/logger" - "one-api/model" - "one-api/setting" "strconv" "strings" "sync" - "one-api/constant" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting" + + "github.com/QuantumNous/new-api/constant" "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" diff --git a/controller/vendor_meta.go b/controller/vendor_meta.go index 21d5a21db..243ed1862 100644 --- a/controller/vendor_meta.go +++ b/controller/vendor_meta.go @@ -3,8 +3,8 @@ package controller import ( "strconv" - "one-api/common" - "one-api/model" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" "github.com/gin-gonic/gin" ) diff --git a/controller/video_proxy.go b/controller/video_proxy.go index 55ba707c0..17e466ae8 100644 --- a/controller/video_proxy.go +++ b/controller/video_proxy.go @@ -4,10 +4,11 @@ import ( "fmt" "io" "net/http" - "one-api/logger" - "one-api/model" "time" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + "github.com/gin-gonic/gin" ) diff --git a/controller/wechat.go b/controller/wechat.go index 9a4bdfedf..07f2fb32e 100644 --- a/controller/wechat.go +++ b/controller/wechat.go @@ -5,11 +5,12 @@ import ( "errors" "fmt" "net/http" - "one-api/common" - "one-api/model" "strconv" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/model" + "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) diff --git a/dto/audio.go b/dto/audio.go index 9d71f6f76..d2ee3abe9 100644 --- a/dto/audio.go +++ b/dto/audio.go @@ -1,7 +1,7 @@ package dto import ( - "one-api/types" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/dto/claude.go b/dto/claude.go index dfc5cfd4c..d66ec2e0a 100644 --- a/dto/claude.go +++ b/dto/claude.go @@ -3,10 +3,11 @@ package dto import ( "encoding/json" "fmt" - "one-api/common" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/dto/embedding.go b/dto/embedding.go index b473b7228..d0730f9f5 100644 --- a/dto/embedding.go +++ b/dto/embedding.go @@ -1,9 +1,10 @@ package dto import ( - "one-api/types" "strings" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/dto/error.go b/dto/error.go index d7f6824dc..79547671b 100644 --- a/dto/error.go +++ b/dto/error.go @@ -1,6 +1,6 @@ package dto -import "one-api/types" +import "github.com/QuantumNous/new-api/types" type OpenAIError struct { Message string `json:"message"` diff --git a/dto/gemini.go b/dto/gemini.go index b91701723..947e90a3f 100644 --- a/dto/gemini.go +++ b/dto/gemini.go @@ -2,11 +2,12 @@ package dto import ( "encoding/json" - "one-api/common" - "one-api/logger" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/dto/openai_image.go b/dto/openai_image.go index 16e9a175d..9750c8093 100644 --- a/dto/openai_image.go +++ b/dto/openai_image.go @@ -2,11 +2,12 @@ package dto import ( "encoding/json" - "one-api/common" - "one-api/types" "reflect" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/dto/openai_request.go b/dto/openai_request.go index d477ee6c6..0b8b5dc54 100644 --- a/dto/openai_request.go +++ b/dto/openai_request.go @@ -3,10 +3,11 @@ package dto import ( "encoding/json" "fmt" - "one-api/common" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/dto/openai_response.go b/dto/openai_response.go index 7a3ddc68e..0c345bacb 100644 --- a/dto/openai_response.go +++ b/dto/openai_response.go @@ -3,7 +3,8 @@ package dto import ( "encoding/json" "fmt" - "one-api/types" + + "github.com/QuantumNous/new-api/types" ) const ( diff --git a/dto/pricing.go b/dto/pricing.go index bc024de30..1ed8dcd31 100644 --- a/dto/pricing.go +++ b/dto/pricing.go @@ -1,6 +1,6 @@ package dto -import "one-api/constant" +import "github.com/QuantumNous/new-api/constant" // 这里不好动就不动了,本来想独立出来的( type OpenAIModels struct { diff --git a/dto/realtime.go b/dto/realtime.go index 32a690568..0fbfb86f0 100644 --- a/dto/realtime.go +++ b/dto/realtime.go @@ -1,6 +1,6 @@ package dto -import "one-api/types" +import "github.com/QuantumNous/new-api/types" const ( RealtimeEventTypeError = "error" diff --git a/dto/request_common.go b/dto/request_common.go index da3ac3c52..e6e40c3a1 100644 --- a/dto/request_common.go +++ b/dto/request_common.go @@ -1,8 +1,8 @@ package dto import ( + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" - "one-api/types" ) type Request interface { diff --git a/dto/rerank.go b/dto/rerank.go index 46f4bce6f..607d68a70 100644 --- a/dto/rerank.go +++ b/dto/rerank.go @@ -2,9 +2,10 @@ package dto import ( "fmt" - "github.com/gin-gonic/gin" - "one-api/types" "strings" + + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) type RerankRequest struct { diff --git a/go.mod b/go.mod index 125cc5c74..b15bbadb2 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module one-api +module github.com/QuantumNous/new-api // +heroku goVersion go1.18 go 1.25.1 diff --git a/go.sum b/go.sum index bea3261b9..bd6bae025 100644 --- a/go.sum +++ b/go.sum @@ -96,8 +96,6 @@ github.com/go-webauthn/x v0.1.25/go.mod h1:ieblaPY1/BVCV0oQTsA/VAo08/TWayQuJuo5Q github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= diff --git a/logger/logger.go b/logger/logger.go index 68f564370..b70f82006 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -6,13 +6,14 @@ import ( "fmt" "io" "log" - "one-api/common" - "one-api/setting/operation_setting" "os" "path/filepath" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/bytedance/gopkg/util/gopool" "github.com/gin-gonic/gin" ) diff --git a/main.go b/main.go index ba96d2099..47f71a20b 100644 --- a/main.go +++ b/main.go @@ -6,20 +6,21 @@ import ( "fmt" "log" "net/http" - "one-api/common" - "one-api/constant" - "one-api/controller" - "one-api/logger" - "one-api/middleware" - "one-api/model" - "one-api/router" - "one-api/service" - "one-api/setting/ratio_setting" "os" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/controller" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/middleware" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/router" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/bytedance/gopkg/util/gopool" "github.com/gin-contrib/sessions" "github.com/gin-contrib/sessions/cookie" diff --git a/middleware/auth.go b/middleware/auth.go index 25caf50d9..b1a932a40 100644 --- a/middleware/auth.go +++ b/middleware/auth.go @@ -3,14 +3,15 @@ package middleware import ( "fmt" "net/http" - "one-api/common" - "one-api/constant" - "one-api/model" - "one-api/setting" - "one-api/setting/ratio_setting" "strconv" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/gin-contrib/sessions" "github.com/gin-gonic/gin" ) diff --git a/middleware/distributor.go b/middleware/distributor.go index a33ca5af9..1cc5d2cea 100644 --- a/middleware/distributor.go +++ b/middleware/distributor.go @@ -4,19 +4,20 @@ import ( "errors" "fmt" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/model" - relayconstant "one-api/relay/constant" - "one-api/service" - "one-api/setting" - "one-api/setting/ratio_setting" - "one-api/types" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/middleware/email-verification-rate-limit.go b/middleware/email-verification-rate-limit.go index a7d828d96..470d7731c 100644 --- a/middleware/email-verification-rate-limit.go +++ b/middleware/email-verification-rate-limit.go @@ -4,9 +4,10 @@ import ( "context" "fmt" "net/http" - "one-api/common" "time" + "github.com/QuantumNous/new-api/common" + "github.com/gin-gonic/gin" ) diff --git a/middleware/gzip.go b/middleware/gzip.go index 5b9d566a4..7fe2f3be3 100644 --- a/middleware/gzip.go +++ b/middleware/gzip.go @@ -2,10 +2,11 @@ package middleware import ( "compress/gzip" - "github.com/andybalholm/brotli" - "github.com/gin-gonic/gin" "io" "net/http" + + "github.com/andybalholm/brotli" + "github.com/gin-gonic/gin" ) func DecompressRequestMiddleware() gin.HandlerFunc { diff --git a/middleware/jimeng_adapter.go b/middleware/jimeng_adapter.go index ce5e14675..3e3dd7ae5 100644 --- a/middleware/jimeng_adapter.go +++ b/middleware/jimeng_adapter.go @@ -3,12 +3,13 @@ package middleware import ( "bytes" "encoding/json" - "github.com/gin-gonic/gin" "io" "net/http" - "one-api/common" - "one-api/constant" - relayconstant "one-api/relay/constant" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/gin-gonic/gin" ) func JimengRequestConvert() func(c *gin.Context) { diff --git a/middleware/kling_adapter.go b/middleware/kling_adapter.go index 20973c9f6..e200379c0 100644 --- a/middleware/kling_adapter.go +++ b/middleware/kling_adapter.go @@ -4,8 +4,9 @@ import ( "bytes" "encoding/json" "io" - "one-api/common" - "one-api/constant" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" "github.com/gin-gonic/gin" ) diff --git a/middleware/logger.go b/middleware/logger.go index 02f2e0a99..b4ed8c89d 100644 --- a/middleware/logger.go +++ b/middleware/logger.go @@ -2,8 +2,9 @@ package middleware import ( "fmt" + + "github.com/QuantumNous/new-api/common" "github.com/gin-gonic/gin" - "one-api/common" ) func SetUpLogger(server *gin.Engine) { diff --git a/middleware/model-rate-limit.go b/middleware/model-rate-limit.go index 14d9a737e..80a3995df 100644 --- a/middleware/model-rate-limit.go +++ b/middleware/model-rate-limit.go @@ -4,13 +4,14 @@ import ( "context" "fmt" "net/http" - "one-api/common" - "one-api/common/limiter" - "one-api/constant" - "one-api/setting" "strconv" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/common/limiter" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/setting" + "github.com/gin-gonic/gin" "github.com/go-redis/redis/v8" ) diff --git a/middleware/rate-limit.go b/middleware/rate-limit.go index e38fb8f66..57aeb3190 100644 --- a/middleware/rate-limit.go +++ b/middleware/rate-limit.go @@ -3,10 +3,11 @@ package middleware import ( "context" "fmt" - "github.com/gin-gonic/gin" "net/http" - "one-api/common" "time" + + "github.com/QuantumNous/new-api/common" + "github.com/gin-gonic/gin" ) var timeFormat = "2006-01-02T15:04:05.000Z" diff --git a/middleware/recover.go b/middleware/recover.go index d78c8137f..745a61015 100644 --- a/middleware/recover.go +++ b/middleware/recover.go @@ -2,10 +2,11 @@ package middleware import ( "fmt" - "github.com/gin-gonic/gin" "net/http" - "one-api/common" "runtime/debug" + + "github.com/QuantumNous/new-api/common" + "github.com/gin-gonic/gin" ) func RelayPanicRecover() gin.HandlerFunc { diff --git a/middleware/request-id.go b/middleware/request-id.go index e623be7a2..2b3e5ddc1 100644 --- a/middleware/request-id.go +++ b/middleware/request-id.go @@ -2,8 +2,9 @@ package middleware import ( "context" + + "github.com/QuantumNous/new-api/common" "github.com/gin-gonic/gin" - "one-api/common" ) func RequestId() func(c *gin.Context) { diff --git a/middleware/turnstile-check.go b/middleware/turnstile-check.go index 106a72781..af87fad44 100644 --- a/middleware/turnstile-check.go +++ b/middleware/turnstile-check.go @@ -2,11 +2,12 @@ package middleware import ( "encoding/json" - "github.com/gin-contrib/sessions" - "github.com/gin-gonic/gin" "net/http" "net/url" - "one-api/common" + + "github.com/QuantumNous/new-api/common" + "github.com/gin-contrib/sessions" + "github.com/gin-gonic/gin" ) type turnstileCheckResponse struct { diff --git a/middleware/utils.go b/middleware/utils.go index 77d1eb805..24caa83c7 100644 --- a/middleware/utils.go +++ b/middleware/utils.go @@ -2,9 +2,10 @@ package middleware import ( "fmt" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" "github.com/gin-gonic/gin" - "one-api/common" - "one-api/logger" ) func abortWithOpenAiMessage(c *gin.Context, statusCode int, message string, code ...string) { diff --git a/model/ability.go b/model/ability.go index 123fc7be5..62cb96fa0 100644 --- a/model/ability.go +++ b/model/ability.go @@ -3,10 +3,11 @@ package model import ( "errors" "fmt" - "one-api/common" "strings" "sync" + "github.com/QuantumNous/new-api/common" + "github.com/samber/lo" "gorm.io/gorm" "gorm.io/gorm/clause" diff --git a/model/channel.go b/model/channel.go index 8d1616a9b..d01f00c97 100644 --- a/model/channel.go +++ b/model/channel.go @@ -6,13 +6,14 @@ import ( "errors" "fmt" "math/rand" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/types" "strings" "sync" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/types" + "github.com/samber/lo" "gorm.io/gorm" ) diff --git a/model/channel_cache.go b/model/channel_cache.go index 86866e404..7637658d5 100644 --- a/model/channel_cache.go +++ b/model/channel_cache.go @@ -4,15 +4,16 @@ import ( "errors" "fmt" "math/rand" - "one-api/common" - "one-api/constant" - "one-api/setting" - "one-api/setting/ratio_setting" "sort" "strings" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/gin-gonic/gin" ) diff --git a/model/log.go b/model/log.go index 979cbe7b2..3df7c5eb8 100644 --- a/model/log.go +++ b/model/log.go @@ -3,13 +3,14 @@ package model import ( "context" "fmt" - "one-api/common" - "one-api/logger" - "one-api/types" "os" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" "github.com/bytedance/gopkg/util/gopool" diff --git a/model/main.go b/model/main.go index 14384caf9..04842f13f 100644 --- a/model/main.go +++ b/model/main.go @@ -3,13 +3,14 @@ package model import ( "fmt" "log" - "one-api/common" - "one-api/constant" "os" "strings" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/glebarez/sqlite" "gorm.io/driver/mysql" "gorm.io/driver/postgres" diff --git a/model/model_meta.go b/model/model_meta.go index e41cbd090..465d15f1d 100644 --- a/model/model_meta.go +++ b/model/model_meta.go @@ -1,9 +1,10 @@ package model import ( - "one-api/common" "strconv" + "github.com/QuantumNous/new-api/common" + "gorm.io/gorm" ) diff --git a/model/option.go b/model/option.go index 77525ea25..de4ca51b0 100644 --- a/model/option.go +++ b/model/option.go @@ -1,15 +1,16 @@ package model import ( - "one-api/common" - "one-api/setting" - "one-api/setting/config" - "one-api/setting/operation_setting" - "one-api/setting/ratio_setting" - "one-api/setting/system_setting" "strconv" "strings" "time" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/config" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/QuantumNous/new-api/setting/system_setting" ) type Option struct { diff --git a/model/passkey.go b/model/passkey.go index 5b2a15474..5d2595cf8 100644 --- a/model/passkey.go +++ b/model/passkey.go @@ -5,10 +5,11 @@ import ( "encoding/json" "errors" "fmt" - "one-api/common" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/go-webauthn/webauthn/protocol" "github.com/go-webauthn/webauthn/webauthn" "gorm.io/gorm" diff --git a/model/prefill_group.go b/model/prefill_group.go index a21b76fe2..cc2e64da9 100644 --- a/model/prefill_group.go +++ b/model/prefill_group.go @@ -3,7 +3,8 @@ package model import ( "database/sql/driver" "encoding/json" - "one-api/common" + + "github.com/QuantumNous/new-api/common" "gorm.io/gorm" ) diff --git a/model/pricing.go b/model/pricing.go index c1192a3d9..d56068a10 100644 --- a/model/pricing.go +++ b/model/pricing.go @@ -5,12 +5,13 @@ import ( "fmt" "strings" - "one-api/common" - "one-api/constant" - "one-api/setting/ratio_setting" - "one-api/types" "sync" "time" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/QuantumNous/new-api/types" ) type Pricing struct { diff --git a/model/redemption.go b/model/redemption.go index 1ab84f45c..7dd2d9527 100644 --- a/model/redemption.go +++ b/model/redemption.go @@ -3,10 +3,11 @@ package model import ( "errors" "fmt" - "one-api/common" - "one-api/logger" "strconv" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" + "gorm.io/gorm" ) diff --git a/model/task.go b/model/task.go index 8e2b6d0be..a93d6339f 100644 --- a/model/task.go +++ b/model/task.go @@ -3,9 +3,10 @@ package model import ( "database/sql/driver" "encoding/json" - "one-api/constant" - commonRelay "one-api/relay/common" "time" + + "github.com/QuantumNous/new-api/constant" + commonRelay "github.com/QuantumNous/new-api/relay/common" ) type TaskStatus string diff --git a/model/token.go b/model/token.go index 320b5cf04..c1fe2a670 100644 --- a/model/token.go +++ b/model/token.go @@ -3,9 +3,10 @@ package model import ( "errors" "fmt" - "one-api/common" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/bytedance/gopkg/util/gopool" "gorm.io/gorm" ) diff --git a/model/token_cache.go b/model/token_cache.go index 5399dbc82..947f587d6 100644 --- a/model/token_cache.go +++ b/model/token_cache.go @@ -2,9 +2,10 @@ package model import ( "fmt" - "one-api/common" - "one-api/constant" "time" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" ) func cacheSetToken(token Token) error { diff --git a/model/topup.go b/model/topup.go index 380f5851d..4f69da30a 100644 --- a/model/topup.go +++ b/model/topup.go @@ -3,8 +3,9 @@ package model import ( "errors" "fmt" - "one-api/common" - "one-api/logger" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" "github.com/shopspring/decimal" "gorm.io/gorm" diff --git a/model/twofa.go b/model/twofa.go index 2a3d33530..e63c66629 100644 --- a/model/twofa.go +++ b/model/twofa.go @@ -3,9 +3,10 @@ package model import ( "errors" "fmt" - "one-api/common" "time" + "github.com/QuantumNous/new-api/common" + "gorm.io/gorm" ) diff --git a/model/usedata.go b/model/usedata.go index 7e525d2e1..f84beb8d9 100644 --- a/model/usedata.go +++ b/model/usedata.go @@ -2,10 +2,11 @@ package model import ( "fmt" - "gorm.io/gorm" - "one-api/common" "sync" "time" + + "github.com/QuantumNous/new-api/common" + "gorm.io/gorm" ) // QuotaData 柱状图数据 diff --git a/model/user.go b/model/user.go index d3e40fa36..78365e06e 100644 --- a/model/user.go +++ b/model/user.go @@ -4,12 +4,13 @@ import ( "encoding/json" "errors" "fmt" - "one-api/common" - "one-api/dto" - "one-api/logger" "strconv" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/bytedance/gopkg/util/gopool" "gorm.io/gorm" ) diff --git a/model/user_cache.go b/model/user_cache.go index 936e1a431..d06acd80e 100644 --- a/model/user_cache.go +++ b/model/user_cache.go @@ -2,11 +2,12 @@ package model import ( "fmt" - "one-api/common" - "one-api/constant" - "one-api/dto" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/gin-gonic/gin" "github.com/bytedance/gopkg/util/gopool" diff --git a/model/utils.go b/model/utils.go index dced2bc61..adfd8e139 100644 --- a/model/utils.go +++ b/model/utils.go @@ -2,10 +2,11 @@ package model import ( "errors" - "one-api/common" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/bytedance/gopkg/util/gopool" "gorm.io/gorm" ) diff --git a/model/vendor_meta.go b/model/vendor_meta.go index 20deaea9b..2bb357f82 100644 --- a/model/vendor_meta.go +++ b/model/vendor_meta.go @@ -1,7 +1,7 @@ package model import ( - "one-api/common" + "github.com/QuantumNous/new-api/common" "gorm.io/gorm" ) diff --git a/new-api.service b/new-api.service new file mode 100644 index 000000000..5a2933615 --- /dev/null +++ b/new-api.service @@ -0,0 +1,18 @@ +# File path: /etc/systemd/system/new-api.service +# sudo systemctl daemon-reload +# sudo systemctl start new-api +# sudo systemctl enable new-api +# sudo systemctl status new-api +[Unit] +Description=One API Service +After=network.target + +[Service] +User=ubuntu # 注意修改用户名 +WorkingDirectory=/path/to/new-api # 注意修改路径 +ExecStart=/path/to/new-api/new-api --port 3000 --log-dir /path/to/new-api/logs # 注意修改路径和端口号 +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target diff --git a/one-api.service b/one-api.service deleted file mode 100644 index 17e236bc5..000000000 --- a/one-api.service +++ /dev/null @@ -1,18 +0,0 @@ -# File path: /etc/systemd/system/one-api.service -# sudo systemctl daemon-reload -# sudo systemctl start one-api -# sudo systemctl enable one-api -# sudo systemctl status one-api -[Unit] -Description=One API Service -After=network.target - -[Service] -User=ubuntu # 注意修改用户名 -WorkingDirectory=/path/to/one-api # 注意修改路径 -ExecStart=/path/to/one-api/one-api --port 3000 --log-dir /path/to/one-api/logs # 注意修改路径和端口号 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target diff --git a/relay/audio_handler.go b/relay/audio_handler.go index 1357e3816..15fbb9390 100644 --- a/relay/audio_handler.go +++ b/relay/audio_handler.go @@ -4,12 +4,13 @@ import ( "errors" "fmt" "net/http" - "one-api/common" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/adapter.go b/relay/channel/adapter.go index 964c33256..7fe18802e 100644 --- a/relay/channel/adapter.go +++ b/relay/channel/adapter.go @@ -3,10 +3,11 @@ package channel import ( "io" "net/http" - "one-api/dto" - "one-api/model" - relaycommon "one-api/relay/common" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/ali/adaptor.go b/relay/channel/ali/adaptor.go index 3ce9e22d3..f289cab35 100644 --- a/relay/channel/ali/adaptor.go +++ b/relay/channel/ali/adaptor.go @@ -5,15 +5,16 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/claude" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/claude" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/ali/dto.go b/relay/channel/ali/dto.go index 0873c99f0..b8072b601 100644 --- a/relay/channel/ali/dto.go +++ b/relay/channel/ali/dto.go @@ -1,6 +1,6 @@ package ali -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" type AliMessage struct { Content any `json:"content"` diff --git a/relay/channel/ali/image.go b/relay/channel/ali/image.go index 490c9d0ad..f2687e047 100644 --- a/relay/channel/ali/image.go +++ b/relay/channel/ali/image.go @@ -8,15 +8,16 @@ import ( "io" "mime/multipart" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/ali/rerank.go b/relay/channel/ali/rerank.go index e7d6b5141..1323fc830 100644 --- a/relay/channel/ali/rerank.go +++ b/relay/channel/ali/rerank.go @@ -4,10 +4,11 @@ import ( "encoding/json" "io" "net/http" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/ali/text.go b/relay/channel/ali/text.go index 67b63286c..7c206d04d 100644 --- a/relay/channel/ali/text.go +++ b/relay/channel/ali/text.go @@ -5,13 +5,14 @@ import ( "encoding/json" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/relay/helper" - "one-api/service" "strings" - "one-api/types" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/api_request.go b/relay/channel/api_request.go index 548e720d9..1ff1e2392 100644 --- a/relay/channel/api_request.go +++ b/relay/channel/api_request.go @@ -6,18 +6,19 @@ import ( "fmt" "io" "net/http" - common2 "one-api/common" - "one-api/logger" - "one-api/relay/common" - "one-api/relay/constant" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/operation_setting" - "one-api/types" "strings" "sync" "time" + common2 "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/types" + "github.com/bytedance/gopkg/util/gopool" "github.com/gin-gonic/gin" "github.com/gorilla/websocket" diff --git a/relay/channel/aws/adaptor.go b/relay/channel/aws/adaptor.go index 92d60df48..437da8d0c 100644 --- a/relay/channel/aws/adaptor.go +++ b/relay/channel/aws/adaptor.go @@ -4,10 +4,11 @@ import ( "errors" "io" "net/http" - "one-api/dto" - "one-api/relay/channel/claude" - relaycommon "one-api/relay/common" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel/claude" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/aws/dto.go b/relay/channel/aws/dto.go index 9c9fe946f..0873b671d 100644 --- a/relay/channel/aws/dto.go +++ b/relay/channel/aws/dto.go @@ -1,7 +1,7 @@ package aws import ( - "one-api/dto" + "github.com/QuantumNous/new-api/dto" ) type AwsClaudeRequest struct { diff --git a/relay/channel/aws/relay-aws.go b/relay/channel/aws/relay-aws.go index eef26855a..fe1b7e7f0 100644 --- a/relay/channel/aws/relay-aws.go +++ b/relay/channel/aws/relay-aws.go @@ -4,14 +4,15 @@ import ( "encoding/json" "fmt" "net/http" - "one-api/common" - "one-api/dto" - "one-api/relay/channel/claude" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel/claude" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" "github.com/pkg/errors" diff --git a/relay/channel/baidu/adaptor.go b/relay/channel/baidu/adaptor.go index 32e301eed..b8b4735b3 100644 --- a/relay/channel/baidu/adaptor.go +++ b/relay/channel/baidu/adaptor.go @@ -5,13 +5,14 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/baidu/dto.go b/relay/channel/baidu/dto.go index a486de5a7..426f63f54 100644 --- a/relay/channel/baidu/dto.go +++ b/relay/channel/baidu/dto.go @@ -1,8 +1,9 @@ package baidu import ( - "one-api/dto" "time" + + "github.com/QuantumNous/new-api/dto" ) type BaiduMessage struct { diff --git a/relay/channel/baidu/relay-baidu.go b/relay/channel/baidu/relay-baidu.go index 31e8319e5..8597e50ef 100644 --- a/relay/channel/baidu/relay-baidu.go +++ b/relay/channel/baidu/relay-baidu.go @@ -6,17 +6,18 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/baidu_v2/adaptor.go b/relay/channel/baidu_v2/adaptor.go index 0577ebcb7..94091e387 100644 --- a/relay/channel/baidu_v2/adaptor.go +++ b/relay/channel/baidu_v2/adaptor.go @@ -5,14 +5,15 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/claude/adaptor.go b/relay/channel/claude/adaptor.go index 17e7cbd2b..b9b7447f2 100644 --- a/relay/channel/claude/adaptor.go +++ b/relay/channel/claude/adaptor.go @@ -5,13 +5,14 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/setting/model_setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/claude/relay-claude.go b/relay/channel/claude/relay-claude.go index 682256416..79d68bb4b 100644 --- a/relay/channel/claude/relay-claude.go +++ b/relay/channel/claude/relay-claude.go @@ -5,17 +5,18 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - "one-api/relay/channel/openrouter" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/model_setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/relay/channel/openrouter" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/cloudflare/adaptor.go b/relay/channel/cloudflare/adaptor.go index bdea72f01..af3446238 100644 --- a/relay/channel/cloudflare/adaptor.go +++ b/relay/channel/cloudflare/adaptor.go @@ -6,12 +6,13 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/cloudflare/dto.go b/relay/channel/cloudflare/dto.go index 72b406155..7dcb67224 100644 --- a/relay/channel/cloudflare/dto.go +++ b/relay/channel/cloudflare/dto.go @@ -1,6 +1,6 @@ package cloudflare -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" type CfRequest struct { Messages []dto.Message `json:"messages,omitempty"` diff --git a/relay/channel/cloudflare/relay_cloudflare.go b/relay/channel/cloudflare/relay_cloudflare.go index 00f6b6c5e..0419103d4 100644 --- a/relay/channel/cloudflare/relay_cloudflare.go +++ b/relay/channel/cloudflare/relay_cloudflare.go @@ -5,15 +5,16 @@ import ( "encoding/json" "io" "net/http" - "one-api/dto" - "one-api/logger" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" "time" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/cohere/adaptor.go b/relay/channel/cohere/adaptor.go index c8a38d465..664eb6784 100644 --- a/relay/channel/cohere/adaptor.go +++ b/relay/channel/cohere/adaptor.go @@ -5,11 +5,12 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/cohere/dto.go b/relay/channel/cohere/dto.go index d51279633..2ab6385c2 100644 --- a/relay/channel/cohere/dto.go +++ b/relay/channel/cohere/dto.go @@ -1,6 +1,6 @@ package cohere -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" type CohereRequest struct { Model string `json:"model"` diff --git a/relay/channel/cohere/relay-cohere.go b/relay/channel/cohere/relay-cohere.go index af3573480..3f86e1e90 100644 --- a/relay/channel/cohere/relay-cohere.go +++ b/relay/channel/cohere/relay-cohere.go @@ -5,15 +5,16 @@ import ( "encoding/json" "io" "net/http" - "one-api/common" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/coze/adaptor.go b/relay/channel/coze/adaptor.go index 0f2a6fd3f..30f229a31 100644 --- a/relay/channel/coze/adaptor.go +++ b/relay/channel/coze/adaptor.go @@ -6,12 +6,13 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/common" - "one-api/types" "time" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/coze/relay-coze.go b/relay/channel/coze/relay-coze.go index c480045f4..5a186d262 100644 --- a/relay/channel/coze/relay-coze.go +++ b/relay/channel/coze/relay-coze.go @@ -7,14 +7,15 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/deepseek/adaptor.go b/relay/channel/deepseek/adaptor.go index 962f8794a..53488f0d5 100644 --- a/relay/channel/deepseek/adaptor.go +++ b/relay/channel/deepseek/adaptor.go @@ -3,17 +3,18 @@ package deepseek import ( "errors" "fmt" - "github.com/gin-gonic/gin" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/claude" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" "strings" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/claude" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) type Adaptor struct { diff --git a/relay/channel/dify/adaptor.go b/relay/channel/dify/adaptor.go index 0a08d035a..4ffee3e60 100644 --- a/relay/channel/dify/adaptor.go +++ b/relay/channel/dify/adaptor.go @@ -5,10 +5,11 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/dify/dto.go b/relay/channel/dify/dto.go index 7c6f39b69..cb127554d 100644 --- a/relay/channel/dify/dto.go +++ b/relay/channel/dify/dto.go @@ -1,6 +1,6 @@ package dify -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" type DifyChatRequest struct { Inputs map[string]interface{} `json:"inputs"` diff --git a/relay/channel/dify/relay-dify.go b/relay/channel/dify/relay-dify.go index 2336fd4c9..fb49dea2a 100644 --- a/relay/channel/dify/relay-dify.go +++ b/relay/channel/dify/relay-dify.go @@ -8,16 +8,17 @@ import ( "io" "mime/multipart" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "os" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/gemini/adaptor.go b/relay/channel/gemini/adaptor.go index 0295f8ecb..b2a8b186f 100644 --- a/relay/channel/gemini/adaptor.go +++ b/relay/channel/gemini/adaptor.go @@ -5,15 +5,16 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/setting/model_setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/gemini/relay-gemini-native.go b/relay/channel/gemini/relay-gemini-native.go index 974a22f50..517e519d6 100644 --- a/relay/channel/gemini/relay-gemini-native.go +++ b/relay/channel/gemini/relay-gemini-native.go @@ -3,15 +3,16 @@ package gemini import ( "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/pkg/errors" "github.com/gin-gonic/gin" diff --git a/relay/channel/gemini/relay-gemini.go b/relay/channel/gemini/relay-gemini.go index a8247217b..f26c7ce7f 100644 --- a/relay/channel/gemini/relay-gemini.go +++ b/relay/channel/gemini/relay-gemini.go @@ -6,20 +6,21 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/logger" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/model_setting" - "one-api/types" "strconv" "strings" "unicode/utf8" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/jimeng/adaptor.go b/relay/channel/jimeng/adaptor.go index 885a1427f..1938ac1be 100644 --- a/relay/channel/jimeng/adaptor.go +++ b/relay/channel/jimeng/adaptor.go @@ -6,12 +6,13 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - relayconstant "one-api/relay/constant" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/jimeng/image.go b/relay/channel/jimeng/image.go index 11a0117bb..e422e061d 100644 --- a/relay/channel/jimeng/image.go +++ b/relay/channel/jimeng/image.go @@ -5,10 +5,11 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/jimeng/sign.go b/relay/channel/jimeng/sign.go index d8b598dce..7c67531e4 100644 --- a/relay/channel/jimeng/sign.go +++ b/relay/channel/jimeng/sign.go @@ -8,14 +8,15 @@ import ( "encoding/json" "errors" "fmt" - "github.com/gin-gonic/gin" "io" "net/http" "net/url" - "one-api/logger" "sort" "strings" "time" + + "github.com/QuantumNous/new-api/logger" + "github.com/gin-gonic/gin" ) // SignRequestForJimeng 对即梦 API 请求进行签名,支持 http.Request 或 header+url+body 方式 diff --git a/relay/channel/jina/adaptor.go b/relay/channel/jina/adaptor.go index dbfe314d5..3f2d01d96 100644 --- a/relay/channel/jina/adaptor.go +++ b/relay/channel/jina/adaptor.go @@ -5,13 +5,14 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/common_handler" - "one-api/relay/constant" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/common_handler" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/minimax/relay-minimax.go b/relay/channel/minimax/relay-minimax.go index ff9b72ea3..033d10334 100644 --- a/relay/channel/minimax/relay-minimax.go +++ b/relay/channel/minimax/relay-minimax.go @@ -2,7 +2,8 @@ package minimax import ( "fmt" - relaycommon "one-api/relay/common" + + relaycommon "github.com/QuantumNous/new-api/relay/common" ) func GetRequestURL(info *relaycommon.RelayInfo) (string, error) { diff --git a/relay/channel/mistral/adaptor.go b/relay/channel/mistral/adaptor.go index f98ff8698..88d72e0fc 100644 --- a/relay/channel/mistral/adaptor.go +++ b/relay/channel/mistral/adaptor.go @@ -4,11 +4,12 @@ import ( "errors" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/mistral/text.go b/relay/channel/mistral/text.go index aa9257811..a6d48f68b 100644 --- a/relay/channel/mistral/text.go +++ b/relay/channel/mistral/text.go @@ -1,9 +1,10 @@ package mistral import ( - "one-api/common" - "one-api/dto" "regexp" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" ) var mistralToolCallIdRegexp = regexp.MustCompile("^[a-zA-Z0-9]{9}$") diff --git a/relay/channel/mokaai/adaptor.go b/relay/channel/mokaai/adaptor.go index f9da685f2..f50c1e6be 100644 --- a/relay/channel/mokaai/adaptor.go +++ b/relay/channel/mokaai/adaptor.go @@ -5,13 +5,14 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/mokaai/relay-mokaai.go b/relay/channel/mokaai/relay-mokaai.go index d91aceb3d..4949ed643 100644 --- a/relay/channel/mokaai/relay-mokaai.go +++ b/relay/channel/mokaai/relay-mokaai.go @@ -4,11 +4,12 @@ import ( "encoding/json" "io" "net/http" - "one-api/common" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/moonshot/adaptor.go b/relay/channel/moonshot/adaptor.go index f24976bb3..f02cb5e87 100644 --- a/relay/channel/moonshot/adaptor.go +++ b/relay/channel/moonshot/adaptor.go @@ -5,13 +5,14 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/claude" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/claude" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/ollama/adaptor.go b/relay/channel/ollama/adaptor.go index d88e04d6f..a3013e2fb 100644 --- a/relay/channel/ollama/adaptor.go +++ b/relay/channel/ollama/adaptor.go @@ -4,14 +4,15 @@ import ( "errors" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - relayconstant "one-api/relay/constant" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/ollama/relay-ollama.go b/relay/channel/ollama/relay-ollama.go index f94a654c7..9c05b1357 100644 --- a/relay/channel/ollama/relay-ollama.go +++ b/relay/channel/ollama/relay-ollama.go @@ -5,13 +5,14 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/ollama/stream.go b/relay/channel/ollama/stream.go index 9a98f7b69..c73f2d50f 100644 --- a/relay/channel/ollama/stream.go +++ b/relay/channel/ollama/stream.go @@ -6,16 +6,17 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/openai/adaptor.go b/relay/channel/openai/adaptor.go index 1d8286a43..ec40fa25b 100644 --- a/relay/channel/openai/adaptor.go +++ b/relay/channel/openai/adaptor.go @@ -9,23 +9,24 @@ import ( "mime/multipart" "net/http" "net/textproto" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/ai360" - "one-api/relay/channel/lingyiwanwu" - "one-api/relay/channel/minimax" - "one-api/relay/channel/openrouter" - "one-api/relay/channel/xinference" - relaycommon "one-api/relay/common" - "one-api/relay/common_handler" - relayconstant "one-api/relay/constant" - "one-api/service" - "one-api/types" "path/filepath" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/ai360" + "github.com/QuantumNous/new-api/relay/channel/lingyiwanwu" + "github.com/QuantumNous/new-api/relay/channel/minimax" + "github.com/QuantumNous/new-api/relay/channel/openrouter" + "github.com/QuantumNous/new-api/relay/channel/xinference" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/common_handler" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/openai/helper.go b/relay/channel/openai/helper.go index e84f6cc4a..69731d4d2 100644 --- a/relay/channel/openai/helper.go +++ b/relay/channel/openai/helper.go @@ -2,16 +2,17 @@ package openai import ( "encoding/json" - "one-api/common" - "one-api/dto" - "one-api/logger" - relaycommon "one-api/relay/common" - relayconstant "one-api/relay/constant" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/samber/lo" "github.com/gin-gonic/gin" diff --git a/relay/channel/openai/relay-openai.go b/relay/channel/openai/relay-openai.go index 6619fb160..f24dec812 100644 --- a/relay/channel/openai/relay-openai.go +++ b/relay/channel/openai/relay-openai.go @@ -8,19 +8,20 @@ import ( "math" "mime/multipart" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/logger" - "one-api/relay/channel/openrouter" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" "os" "path/filepath" "strings" - "one-api/types" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/relay/channel/openrouter" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + + "github.com/QuantumNous/new-api/types" "github.com/bytedance/gopkg/util/gopool" "github.com/gin-gonic/gin" diff --git a/relay/channel/openai/relay_responses.go b/relay/channel/openai/relay_responses.go index 7b148f323..3f8eb69a8 100644 --- a/relay/channel/openai/relay_responses.go +++ b/relay/channel/openai/relay_responses.go @@ -4,15 +4,16 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/palm/adaptor.go b/relay/channel/palm/adaptor.go index 2a022a1b8..f06be051c 100644 --- a/relay/channel/palm/adaptor.go +++ b/relay/channel/palm/adaptor.go @@ -5,11 +5,12 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/palm/dto.go b/relay/channel/palm/dto.go index b8a48e73c..47ca3fc66 100644 --- a/relay/channel/palm/dto.go +++ b/relay/channel/palm/dto.go @@ -1,6 +1,6 @@ package palm -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" type PaLMChatMessage struct { Author string `json:"author"` diff --git a/relay/channel/palm/relay-palm.go b/relay/channel/palm/relay-palm.go index 3a6ec2f4b..abfb92c0e 100644 --- a/relay/channel/palm/relay-palm.go +++ b/relay/channel/palm/relay-palm.go @@ -4,13 +4,14 @@ import ( "encoding/json" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/perplexity/adaptor.go b/relay/channel/perplexity/adaptor.go index 8a561bdec..43e39b12e 100644 --- a/relay/channel/perplexity/adaptor.go +++ b/relay/channel/perplexity/adaptor.go @@ -5,11 +5,12 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/perplexity/relay-perplexity.go b/relay/channel/perplexity/relay-perplexity.go index d2119973c..b07bed68a 100644 --- a/relay/channel/perplexity/relay-perplexity.go +++ b/relay/channel/perplexity/relay-perplexity.go @@ -1,6 +1,6 @@ package perplexity -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" func requestOpenAI2Perplexity(request dto.GeneralOpenAIRequest) *dto.GeneralOpenAIRequest { messages := make([]dto.Message, 0, len(request.Messages)) diff --git a/relay/channel/siliconflow/adaptor.go b/relay/channel/siliconflow/adaptor.go index 41ab76327..f2fb1b776 100644 --- a/relay/channel/siliconflow/adaptor.go +++ b/relay/channel/siliconflow/adaptor.go @@ -5,12 +5,13 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/siliconflow/dto.go b/relay/channel/siliconflow/dto.go index add0fd070..f075542c0 100644 --- a/relay/channel/siliconflow/dto.go +++ b/relay/channel/siliconflow/dto.go @@ -1,6 +1,6 @@ package siliconflow -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" type SFTokens struct { InputTokens int `json:"input_tokens"` diff --git a/relay/channel/siliconflow/relay-siliconflow.go b/relay/channel/siliconflow/relay-siliconflow.go index b21faccb7..421731fb1 100644 --- a/relay/channel/siliconflow/relay-siliconflow.go +++ b/relay/channel/siliconflow/relay-siliconflow.go @@ -4,10 +4,11 @@ import ( "encoding/json" "io" "net/http" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/submodel/adaptor.go b/relay/channel/submodel/adaptor.go index db58fe64c..58b2a3b29 100644 --- a/relay/channel/submodel/adaptor.go +++ b/relay/channel/submodel/adaptor.go @@ -4,11 +4,12 @@ import ( "errors" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/task/doubao/adaptor.go b/relay/channel/task/doubao/adaptor.go index 8cc1fa4f5..1bacb2019 100644 --- a/relay/channel/task/doubao/adaptor.go +++ b/relay/channel/task/doubao/adaptor.go @@ -6,12 +6,13 @@ import ( "fmt" "io" "net/http" - "one-api/constant" - "one-api/dto" - "one-api/model" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/service" + + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" "github.com/gin-gonic/gin" "github.com/pkg/errors" diff --git a/relay/channel/task/jimeng/adaptor.go b/relay/channel/task/jimeng/adaptor.go index a2545a273..6c94a4d29 100644 --- a/relay/channel/task/jimeng/adaptor.go +++ b/relay/channel/task/jimeng/adaptor.go @@ -10,19 +10,20 @@ import ( "io" "net/http" "net/url" - "one-api/model" "sort" "strings" "time" + "github.com/QuantumNous/new-api/model" + "github.com/gin-gonic/gin" "github.com/pkg/errors" - "one-api/constant" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/service" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" ) // ============================ diff --git a/relay/channel/task/kling/adaptor.go b/relay/channel/task/kling/adaptor.go index 4befd8e2e..c89f8f2e4 100644 --- a/relay/channel/task/kling/adaptor.go +++ b/relay/channel/task/kling/adaptor.go @@ -6,11 +6,12 @@ import ( "fmt" "io" "net/http" - "one-api/model" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/model" + "github.com/bytedance/gopkg/util/logger" "github.com/samber/lo" @@ -18,11 +19,11 @@ import ( "github.com/golang-jwt/jwt/v5" "github.com/pkg/errors" - "one-api/constant" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/service" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" ) // ============================ diff --git a/relay/channel/task/sora/adaptor.go b/relay/channel/task/sora/adaptor.go index 3ceed42d8..89b51f560 100644 --- a/relay/channel/task/sora/adaptor.go +++ b/relay/channel/task/sora/adaptor.go @@ -6,13 +6,14 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/model" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/setting/system_setting" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/system_setting" "github.com/gin-gonic/gin" "github.com/pkg/errors" diff --git a/relay/channel/task/suno/adaptor.go b/relay/channel/task/suno/adaptor.go index 237513d75..c4858d0c0 100644 --- a/relay/channel/task/suno/adaptor.go +++ b/relay/channel/task/suno/adaptor.go @@ -7,15 +7,16 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/service" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/task/vertex/adaptor.go b/relay/channel/task/vertex/adaptor.go index 4a236b2f0..faedebdf2 100644 --- a/relay/channel/task/vertex/adaptor.go +++ b/relay/channel/task/vertex/adaptor.go @@ -7,18 +7,19 @@ import ( "fmt" "io" "net/http" - "one-api/model" "regexp" "strings" + "github.com/QuantumNous/new-api/model" + "github.com/gin-gonic/gin" - "one-api/constant" - "one-api/dto" - "one-api/relay/channel" - vertexcore "one-api/relay/channel/vertex" - relaycommon "one-api/relay/common" - "one-api/service" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + vertexcore "github.com/QuantumNous/new-api/relay/channel/vertex" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" ) // ============================ diff --git a/relay/channel/task/vidu/adaptor.go b/relay/channel/task/vidu/adaptor.go index 358aef583..019352c61 100644 --- a/relay/channel/task/vidu/adaptor.go +++ b/relay/channel/task/vidu/adaptor.go @@ -9,12 +9,12 @@ import ( "github.com/gin-gonic/gin" - "one-api/constant" - "one-api/dto" - "one-api/model" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/service" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" "github.com/pkg/errors" ) diff --git a/relay/channel/tencent/adaptor.go b/relay/channel/tencent/adaptor.go index ab96ecaa3..eb6985537 100644 --- a/relay/channel/tencent/adaptor.go +++ b/relay/channel/tencent/adaptor.go @@ -5,15 +5,16 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/types" "strconv" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/tencent/relay-tencent.go b/relay/channel/tencent/relay-tencent.go index f33a275c6..75bc6b71a 100644 --- a/relay/channel/tencent/relay-tencent.go +++ b/relay/channel/tencent/relay-tencent.go @@ -10,17 +10,18 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/vertex/adaptor.go b/relay/channel/vertex/adaptor.go index c4781813c..94ca47657 100644 --- a/relay/channel/vertex/adaptor.go +++ b/relay/channel/vertex/adaptor.go @@ -6,18 +6,19 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/claude" - "one-api/relay/channel/gemini" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/setting/model_setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/claude" + "github.com/QuantumNous/new-api/relay/channel/gemini" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/vertex/dto.go b/relay/channel/vertex/dto.go index 4a571612b..68044ff32 100644 --- a/relay/channel/vertex/dto.go +++ b/relay/channel/vertex/dto.go @@ -1,7 +1,7 @@ package vertex import ( - "one-api/dto" + "github.com/QuantumNous/new-api/dto" ) type VertexAIClaudeRequest struct { diff --git a/relay/channel/vertex/relay-vertex.go b/relay/channel/vertex/relay-vertex.go index f0b84906a..c5103a977 100644 --- a/relay/channel/vertex/relay-vertex.go +++ b/relay/channel/vertex/relay-vertex.go @@ -1,6 +1,6 @@ package vertex -import "one-api/common" +import "github.com/QuantumNous/new-api/common" func GetModelRegion(other string, localModelName string) string { // if other is json string diff --git a/relay/channel/vertex/service_account.go b/relay/channel/vertex/service_account.go index 14a7ea8ce..96ec6b28f 100644 --- a/relay/channel/vertex/service_account.go +++ b/relay/channel/vertex/service_account.go @@ -8,10 +8,11 @@ import ( "errors" "net/http" "net/url" - relaycommon "one-api/relay/common" - "one-api/service" "strings" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/bytedance/gopkg/cache/asynccache" "github.com/golang-jwt/jwt/v5" diff --git a/relay/channel/volcengine/adaptor.go b/relay/channel/volcengine/adaptor.go index 234ab4c99..a428f08ce 100644 --- a/relay/channel/volcengine/adaptor.go +++ b/relay/channel/volcengine/adaptor.go @@ -9,16 +9,17 @@ import ( "mime/multipart" "net/http" "net/textproto" - channelconstant "one-api/constant" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/constant" - "one-api/types" "path/filepath" "strings" + channelconstant "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/xai/adaptor.go b/relay/channel/xai/adaptor.go index d5671ab2f..b130723e7 100644 --- a/relay/channel/xai/adaptor.go +++ b/relay/channel/xai/adaptor.go @@ -4,14 +4,15 @@ import ( "errors" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/types" "strings" - "one-api/relay/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" + + "github.com/QuantumNous/new-api/relay/constant" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/xai/dto.go b/relay/channel/xai/dto.go index 107a980a8..371d62a43 100644 --- a/relay/channel/xai/dto.go +++ b/relay/channel/xai/dto.go @@ -1,6 +1,6 @@ package xai -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" // ChatCompletionResponse represents the response from XAI chat completion API type ChatCompletionResponse struct { diff --git a/relay/channel/xai/text.go b/relay/channel/xai/text.go index 5cae9c0ae..752d40c18 100644 --- a/relay/channel/xai/text.go +++ b/relay/channel/xai/text.go @@ -4,15 +4,16 @@ import ( "encoding/json" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/xunfei/adaptor.go b/relay/channel/xunfei/adaptor.go index 7ee76f1ad..686b0cbd2 100644 --- a/relay/channel/xunfei/adaptor.go +++ b/relay/channel/xunfei/adaptor.go @@ -4,12 +4,13 @@ import ( "errors" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/channel/xunfei/dto.go b/relay/channel/xunfei/dto.go index c169e5f79..71a40f2d0 100644 --- a/relay/channel/xunfei/dto.go +++ b/relay/channel/xunfei/dto.go @@ -1,6 +1,6 @@ package xunfei -import "one-api/dto" +import "github.com/QuantumNous/new-api/dto" type XunfeiMessage struct { Role string `json:"role"` diff --git a/relay/channel/xunfei/relay-xunfei.go b/relay/channel/xunfei/relay-xunfei.go index 9503d5d39..b8fbd2958 100644 --- a/relay/channel/xunfei/relay-xunfei.go +++ b/relay/channel/xunfei/relay-xunfei.go @@ -8,14 +8,15 @@ import ( "fmt" "io" "net/url" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/relay/helper" - "one-api/types" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" "github.com/gorilla/websocket" ) diff --git a/relay/channel/zhipu/adaptor.go b/relay/channel/zhipu/adaptor.go index bd27c90b0..23016fd3b 100644 --- a/relay/channel/zhipu/adaptor.go +++ b/relay/channel/zhipu/adaptor.go @@ -5,10 +5,11 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/zhipu/dto.go b/relay/channel/zhipu/dto.go index 2682dd3a4..5ca91362d 100644 --- a/relay/channel/zhipu/dto.go +++ b/relay/channel/zhipu/dto.go @@ -1,8 +1,9 @@ package zhipu import ( - "one-api/dto" "time" + + "github.com/QuantumNous/new-api/dto" ) type ZhipuMessage struct { diff --git a/relay/channel/zhipu/relay-zhipu.go b/relay/channel/zhipu/relay-zhipu.go index 86ec1eafb..964dff082 100644 --- a/relay/channel/zhipu/relay-zhipu.go +++ b/relay/channel/zhipu/relay-zhipu.go @@ -5,17 +5,18 @@ import ( "encoding/json" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" "strings" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" "github.com/golang-jwt/jwt/v5" ) diff --git a/relay/channel/zhipu_4v/adaptor.go b/relay/channel/zhipu_4v/adaptor.go index 37c0c3521..575da7cbf 100644 --- a/relay/channel/zhipu_4v/adaptor.go +++ b/relay/channel/zhipu_4v/adaptor.go @@ -5,13 +5,14 @@ import ( "fmt" "io" "net/http" - "one-api/dto" - "one-api/relay/channel" - "one-api/relay/channel/claude" - "one-api/relay/channel/openai" - relaycommon "one-api/relay/common" - relayconstant "one-api/relay/constant" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/claude" + "github.com/QuantumNous/new-api/relay/channel/openai" + relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/channel/zhipu_4v/dto.go b/relay/channel/zhipu_4v/dto.go index 4d867679c..e5edd0ddf 100644 --- a/relay/channel/zhipu_4v/dto.go +++ b/relay/channel/zhipu_4v/dto.go @@ -1,8 +1,9 @@ package zhipu_4v import ( - "one-api/dto" "time" + + "github.com/QuantumNous/new-api/dto" ) // type ZhipuMessage struct { diff --git a/relay/channel/zhipu_4v/relay-zhipu_v4.go b/relay/channel/zhipu_4v/relay-zhipu_v4.go index aec87dd5d..53e94e14b 100644 --- a/relay/channel/zhipu_4v/relay-zhipu_v4.go +++ b/relay/channel/zhipu_4v/relay-zhipu_v4.go @@ -1,8 +1,9 @@ package zhipu_4v import ( - "one-api/dto" "strings" + + "github.com/QuantumNous/new-api/dto" ) func requestOpenAI2Zhipu(request dto.GeneralOpenAIRequest) *dto.GeneralOpenAIRequest { diff --git a/relay/claude_handler.go b/relay/claude_handler.go index 3a739785f..c71a5ca2b 100644 --- a/relay/claude_handler.go +++ b/relay/claude_handler.go @@ -5,16 +5,17 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/model_setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/common/override.go b/relay/common/override.go index 212cf7b47..c86d8b34c 100644 --- a/relay/common/override.go +++ b/relay/common/override.go @@ -3,11 +3,12 @@ package common import ( "encoding/json" "fmt" - "github.com/tidwall/gjson" - "github.com/tidwall/sjson" "regexp" "strconv" "strings" + + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" ) type ConditionOperation struct { diff --git a/relay/common/relay_info.go b/relay/common/relay_info.go index cb3a6709f..35df62f80 100644 --- a/relay/common/relay_info.go +++ b/relay/common/relay_info.go @@ -3,14 +3,15 @@ package common import ( "errors" "fmt" - "one-api/common" - "one-api/constant" - "one-api/dto" - relayconstant "one-api/relay/constant" - "one-api/types" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" "github.com/gorilla/websocket" ) diff --git a/relay/common/relay_utils.go b/relay/common/relay_utils.go index 9a6161bae..b38baf13a 100644 --- a/relay/common/relay_utils.go +++ b/relay/common/relay_utils.go @@ -3,12 +3,13 @@ package common import ( "fmt" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" "strconv" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/gin-gonic/gin" "github.com/samber/lo" ) diff --git a/relay/common_handler/rerank.go b/relay/common_handler/rerank.go index 05dbfa6d7..daf005df4 100644 --- a/relay/common_handler/rerank.go +++ b/relay/common_handler/rerank.go @@ -3,13 +3,14 @@ package common_handler import ( "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/relay/channel/xinference" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel/xinference" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/compatible_handler.go b/relay/compatible_handler.go index a3ddf6d49..1975eb423 100644 --- a/relay/compatible_handler.go +++ b/relay/compatible_handler.go @@ -5,20 +5,21 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/logger" - "one-api/model" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/model_setting" - "one-api/setting/operation_setting" - "one-api/types" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/types" + "github.com/shopspring/decimal" "github.com/gin-gonic/gin" diff --git a/relay/embedding_handler.go b/relay/embedding_handler.go index 3d8962bb4..a67794455 100644 --- a/relay/embedding_handler.go +++ b/relay/embedding_handler.go @@ -5,12 +5,13 @@ import ( "encoding/json" "fmt" "net/http" - "one-api/common" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/gemini_handler.go b/relay/gemini_handler.go index 1410da606..a95b67f8b 100644 --- a/relay/gemini_handler.go +++ b/relay/gemini_handler.go @@ -5,18 +5,19 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/logger" - "one-api/relay/channel/gemini" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/model_setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/relay/channel/gemini" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/helper/common.go b/relay/helper/common.go index 381147ae5..3bb1c80c9 100644 --- a/relay/helper/common.go +++ b/relay/helper/common.go @@ -4,10 +4,11 @@ import ( "errors" "fmt" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" "github.com/gorilla/websocket" diff --git a/relay/helper/model_mapped.go b/relay/helper/model_mapped.go index 5b64cd8b3..821158fae 100644 --- a/relay/helper/model_mapped.go +++ b/relay/helper/model_mapped.go @@ -4,9 +4,10 @@ import ( "encoding/json" "errors" "fmt" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/common" "github.com/gin-gonic/gin" - "one-api/dto" - "one-api/relay/common" ) func ModelMappedHelper(c *gin.Context, info *common.RelayInfo, request dto.Request) error { diff --git a/relay/helper/price.go b/relay/helper/price.go index 08ae78c4c..67051eeee 100644 --- a/relay/helper/price.go +++ b/relay/helper/price.go @@ -2,10 +2,11 @@ package helper import ( "fmt" - "one-api/common" - relaycommon "one-api/relay/common" - "one-api/setting/ratio_setting" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/helper/stream_scanner.go b/relay/helper/stream_scanner.go index 725d178cc..9044a1650 100644 --- a/relay/helper/stream_scanner.go +++ b/relay/helper/stream_scanner.go @@ -6,15 +6,16 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/logger" - relaycommon "one-api/relay/common" - "one-api/setting/operation_setting" "strings" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/logger" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/bytedance/gopkg/util/gopool" "github.com/gin-gonic/gin" diff --git a/relay/helper/valid_request.go b/relay/helper/valid_request.go index c9d3ed0b7..a761c68ce 100644 --- a/relay/helper/valid_request.go +++ b/relay/helper/valid_request.go @@ -4,13 +4,14 @@ import ( "errors" "fmt" "math" - "one-api/common" - "one-api/dto" - "one-api/logger" - relayconstant "one-api/relay/constant" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/image_handler.go b/relay/image_handler.go index 9c873d47f..afb9446a1 100644 --- a/relay/image_handler.go +++ b/relay/image_handler.go @@ -5,16 +5,17 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/model_setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/mjproxy_handler.go b/relay/mjproxy_handler.go index ec8dfc6b2..ad42dfecc 100644 --- a/relay/mjproxy_handler.go +++ b/relay/mjproxy_handler.go @@ -7,20 +7,21 @@ import ( "io" "log" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/model" - relaycommon "one-api/relay/common" - relayconstant "one-api/relay/constant" - "one-api/relay/helper" - "one-api/service" - "one-api/setting" - "one-api/setting/system_setting" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/gin-gonic/gin" ) diff --git a/relay/relay_adaptor.go b/relay/relay_adaptor.go index 2017c9a6f..73ae099c0 100644 --- a/relay/relay_adaptor.go +++ b/relay/relay_adaptor.go @@ -1,46 +1,47 @@ package relay import ( - "github.com/gin-gonic/gin" - "one-api/constant" - "one-api/relay/channel" - "one-api/relay/channel/ali" - "one-api/relay/channel/aws" - "one-api/relay/channel/baidu" - "one-api/relay/channel/baidu_v2" - "one-api/relay/channel/claude" - "one-api/relay/channel/cloudflare" - "one-api/relay/channel/cohere" - "one-api/relay/channel/coze" - "one-api/relay/channel/deepseek" - "one-api/relay/channel/dify" - "one-api/relay/channel/gemini" - "one-api/relay/channel/jimeng" - "one-api/relay/channel/jina" - "one-api/relay/channel/mistral" - "one-api/relay/channel/mokaai" - "one-api/relay/channel/moonshot" - "one-api/relay/channel/ollama" - "one-api/relay/channel/openai" - "one-api/relay/channel/palm" - "one-api/relay/channel/perplexity" - "one-api/relay/channel/siliconflow" - "one-api/relay/channel/submodel" - taskdoubao "one-api/relay/channel/task/doubao" - taskjimeng "one-api/relay/channel/task/jimeng" - "one-api/relay/channel/task/kling" - tasksora "one-api/relay/channel/task/sora" - "one-api/relay/channel/task/suno" - taskvertex "one-api/relay/channel/task/vertex" - taskVidu "one-api/relay/channel/task/vidu" - "one-api/relay/channel/tencent" - "one-api/relay/channel/vertex" - "one-api/relay/channel/volcengine" - "one-api/relay/channel/xai" - "one-api/relay/channel/xunfei" - "one-api/relay/channel/zhipu" - "one-api/relay/channel/zhipu_4v" "strconv" + + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/relay/channel" + "github.com/QuantumNous/new-api/relay/channel/ali" + "github.com/QuantumNous/new-api/relay/channel/aws" + "github.com/QuantumNous/new-api/relay/channel/baidu" + "github.com/QuantumNous/new-api/relay/channel/baidu_v2" + "github.com/QuantumNous/new-api/relay/channel/claude" + "github.com/QuantumNous/new-api/relay/channel/cloudflare" + "github.com/QuantumNous/new-api/relay/channel/cohere" + "github.com/QuantumNous/new-api/relay/channel/coze" + "github.com/QuantumNous/new-api/relay/channel/deepseek" + "github.com/QuantumNous/new-api/relay/channel/dify" + "github.com/QuantumNous/new-api/relay/channel/gemini" + "github.com/QuantumNous/new-api/relay/channel/jimeng" + "github.com/QuantumNous/new-api/relay/channel/jina" + "github.com/QuantumNous/new-api/relay/channel/mistral" + "github.com/QuantumNous/new-api/relay/channel/mokaai" + "github.com/QuantumNous/new-api/relay/channel/moonshot" + "github.com/QuantumNous/new-api/relay/channel/ollama" + "github.com/QuantumNous/new-api/relay/channel/openai" + "github.com/QuantumNous/new-api/relay/channel/palm" + "github.com/QuantumNous/new-api/relay/channel/perplexity" + "github.com/QuantumNous/new-api/relay/channel/siliconflow" + "github.com/QuantumNous/new-api/relay/channel/submodel" + taskdoubao "github.com/QuantumNous/new-api/relay/channel/task/doubao" + taskjimeng "github.com/QuantumNous/new-api/relay/channel/task/jimeng" + "github.com/QuantumNous/new-api/relay/channel/task/kling" + tasksora "github.com/QuantumNous/new-api/relay/channel/task/sora" + "github.com/QuantumNous/new-api/relay/channel/task/suno" + taskvertex "github.com/QuantumNous/new-api/relay/channel/task/vertex" + taskVidu "github.com/QuantumNous/new-api/relay/channel/task/vidu" + "github.com/QuantumNous/new-api/relay/channel/tencent" + "github.com/QuantumNous/new-api/relay/channel/vertex" + "github.com/QuantumNous/new-api/relay/channel/volcengine" + "github.com/QuantumNous/new-api/relay/channel/xai" + "github.com/QuantumNous/new-api/relay/channel/xunfei" + "github.com/QuantumNous/new-api/relay/channel/zhipu" + "github.com/QuantumNous/new-api/relay/channel/zhipu_4v" + "github.com/gin-gonic/gin" ) func GetAdaptor(apiType int) channel.Adaptor { diff --git a/relay/relay_task.go b/relay/relay_task.go index fdf6f47cd..4a30fb68b 100644 --- a/relay/relay_task.go +++ b/relay/relay_task.go @@ -7,18 +7,19 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/model" - "one-api/relay/channel" - relaycommon "one-api/relay/common" - relayconstant "one-api/relay/constant" - "one-api/service" - "one-api/setting/ratio_setting" "strconv" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/relay/channel" + relaycommon "github.com/QuantumNous/new-api/relay/common" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/gin-gonic/gin" ) diff --git a/relay/rerank_handler.go b/relay/rerank_handler.go index 46d2e25f6..06aebbd1c 100644 --- a/relay/rerank_handler.go +++ b/relay/rerank_handler.go @@ -5,13 +5,14 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/model_setting" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/relay/responses_handler.go b/relay/responses_handler.go index 6958f96ef..8087e2391 100644 --- a/relay/responses_handler.go +++ b/relay/responses_handler.go @@ -5,15 +5,16 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/relay/helper" - "one-api/service" - "one-api/setting/model_setting" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/relay/helper" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/setting/model_setting" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/relay/websocket.go b/relay/websocket.go index 2d313154c..57a51895b 100644 --- a/relay/websocket.go +++ b/relay/websocket.go @@ -2,10 +2,11 @@ package relay import ( "fmt" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/service" - "one-api/types" + + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/service" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" "github.com/gorilla/websocket" diff --git a/router/api-router.go b/router/api-router.go index 7eefa936a..6b0b934ee 100644 --- a/router/api-router.go +++ b/router/api-router.go @@ -1,8 +1,8 @@ package router import ( - "one-api/controller" - "one-api/middleware" + "github.com/QuantumNous/new-api/controller" + "github.com/QuantumNous/new-api/middleware" "github.com/gin-contrib/gzip" "github.com/gin-gonic/gin" diff --git a/router/dashboard.go b/router/dashboard.go index 940006790..17132dfb2 100644 --- a/router/dashboard.go +++ b/router/dashboard.go @@ -1,10 +1,10 @@ package router import ( + "github.com/QuantumNous/new-api/controller" + "github.com/QuantumNous/new-api/middleware" "github.com/gin-contrib/gzip" "github.com/gin-gonic/gin" - "one-api/controller" - "one-api/middleware" ) func SetDashboardRouter(router *gin.Engine) { diff --git a/router/main.go b/router/main.go index 235764270..45b3080f2 100644 --- a/router/main.go +++ b/router/main.go @@ -4,10 +4,11 @@ import ( "embed" "fmt" "net/http" - "one-api/common" "os" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/gin-gonic/gin" ) diff --git a/router/relay-router.go b/router/relay-router.go index e0f05e97b..267459e2c 100644 --- a/router/relay-router.go +++ b/router/relay-router.go @@ -1,11 +1,11 @@ package router import ( - "one-api/constant" - "one-api/controller" - "one-api/middleware" - "one-api/relay" - "one-api/types" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/controller" + "github.com/QuantumNous/new-api/middleware" + "github.com/QuantumNous/new-api/relay" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/router/video-router.go b/router/video-router.go index e1538e636..72459fe18 100644 --- a/router/video-router.go +++ b/router/video-router.go @@ -1,8 +1,8 @@ package router import ( - "one-api/controller" - "one-api/middleware" + "github.com/QuantumNous/new-api/controller" + "github.com/QuantumNous/new-api/middleware" "github.com/gin-gonic/gin" ) diff --git a/router/web-router.go b/router/web-router.go index 57cd61ac0..b053a3e63 100644 --- a/router/web-router.go +++ b/router/web-router.go @@ -2,14 +2,15 @@ package router import ( "embed" + "net/http" + "strings" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/controller" + "github.com/QuantumNous/new-api/middleware" "github.com/gin-contrib/gzip" "github.com/gin-contrib/static" "github.com/gin-gonic/gin" - "net/http" - "one-api/common" - "one-api/controller" - "one-api/middleware" - "strings" ) func SetWebRouter(router *gin.Engine, buildFS embed.FS, indexPage []byte) { diff --git a/service/channel.go b/service/channel.go index 5c55855b2..8f8a35726 100644 --- a/service/channel.go +++ b/service/channel.go @@ -3,13 +3,14 @@ package service import ( "fmt" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/model" - "one-api/setting/operation_setting" - "one-api/types" "strings" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/types" ) func formatNotifyType(channelId int, status int) string { diff --git a/service/convert.go b/service/convert.go index 1a39e537a..1dc26c0fb 100644 --- a/service/convert.go +++ b/service/convert.go @@ -3,12 +3,13 @@ package service import ( "encoding/json" "fmt" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/relay/channel/openrouter" - relaycommon "one-api/relay/common" "strings" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/relay/channel/openrouter" + relaycommon "github.com/QuantumNous/new-api/relay/common" ) func ClaudeToOpenAIRequest(claudeRequest dto.ClaudeRequest, info *relaycommon.RelayInfo) (*dto.GeneralOpenAIRequest, error) { diff --git a/service/download.go b/service/download.go index 09464390e..752d8c65b 100644 --- a/service/download.go +++ b/service/download.go @@ -5,9 +5,10 @@ import ( "encoding/json" "fmt" "net/http" - "one-api/common" - "one-api/setting/system_setting" "strings" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/setting/system_setting" ) // WorkerRequest Worker请求的数据结构 diff --git a/service/epay.go b/service/epay.go index 48b84dd58..bfe14371e 100644 --- a/service/epay.go +++ b/service/epay.go @@ -1,8 +1,8 @@ package service import ( - "one-api/setting/operation_setting" - "one-api/setting/system_setting" + "github.com/QuantumNous/new-api/setting/operation_setting" + "github.com/QuantumNous/new-api/setting/system_setting" ) func GetCallbackAddress() string { diff --git a/service/error.go b/service/error.go index 5c3bddd6e..2cfd9aba0 100644 --- a/service/error.go +++ b/service/error.go @@ -6,12 +6,13 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/dto" - "one-api/logger" - "one-api/types" "strconv" "strings" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/types" ) func MidjourneyErrorWrapper(code int, desc string) *dto.MidjourneyResponse { diff --git a/service/file_decoder.go b/service/file_decoder.go index 99fdc3f9a..4ca139794 100644 --- a/service/file_decoder.go +++ b/service/file_decoder.go @@ -10,12 +10,13 @@ import ( _ "image/png" "io" "net/http" - "one-api/common" - "one-api/constant" - "one-api/logger" - "one-api/types" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" ) diff --git a/service/http.go b/service/http.go index 357a2e788..7bd54c4ac 100644 --- a/service/http.go +++ b/service/http.go @@ -5,8 +5,9 @@ import ( "fmt" "io" "net/http" - "one-api/common" - "one-api/logger" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" "github.com/gin-gonic/gin" ) diff --git a/service/http_client.go b/service/http_client.go index 79eca4a98..8bc044544 100644 --- a/service/http_client.go +++ b/service/http_client.go @@ -6,11 +6,12 @@ import ( "net" "net/http" "net/url" - "one-api/common" - "one-api/setting/system_setting" "sync" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/setting/system_setting" + "golang.org/x/net/proxy" ) diff --git a/service/image.go b/service/image.go index 453d8dd1c..72ab892d9 100644 --- a/service/image.go +++ b/service/image.go @@ -8,10 +8,11 @@ import ( "image" "io" "net/http" - "one-api/common" - "one-api/constant" "strings" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "golang.org/x/image/webp" ) diff --git a/service/log_info_generate.go b/service/log_info_generate.go index 7a609c9f5..5b737692e 100644 --- a/service/log_info_generate.go +++ b/service/log_info_generate.go @@ -1,11 +1,11 @@ package service import ( - "one-api/common" - "one-api/constant" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/types" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/gin-gonic/gin" ) diff --git a/service/midjourney.go b/service/midjourney.go index 916d02d0b..9b2eb5ca7 100644 --- a/service/midjourney.go +++ b/service/midjourney.go @@ -6,15 +6,16 @@ import ( "io" "log" "net/http" - "one-api/common" - "one-api/constant" - "one-api/dto" - relayconstant "one-api/relay/constant" - "one-api/setting" "strconv" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relayconstant "github.com/QuantumNous/new-api/relay/constant" + "github.com/QuantumNous/new-api/setting" + "github.com/gin-gonic/gin" ) diff --git a/service/notify-limit.go b/service/notify-limit.go index 309ea54d2..cad5d7bc1 100644 --- a/service/notify-limit.go +++ b/service/notify-limit.go @@ -2,12 +2,13 @@ package service import ( "fmt" - "github.com/bytedance/gopkg/util/gopool" - "one-api/common" - "one-api/constant" "strconv" "sync" "time" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/bytedance/gopkg/util/gopool" ) // notifyLimitStore is used for in-memory rate limiting when Redis is disabled diff --git a/service/passkey/service.go b/service/passkey/service.go index dc8da0ccc..4d29d1aef 100644 --- a/service/passkey/service.go +++ b/service/passkey/service.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "one-api/common" - "one-api/setting/system_setting" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/setting/system_setting" "github.com/go-webauthn/webauthn/protocol" webauthn "github.com/go-webauthn/webauthn/webauthn" diff --git a/service/passkey/user.go b/service/passkey/user.go index 8b8c559f0..2ec248a9d 100644 --- a/service/passkey/user.go +++ b/service/passkey/user.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "one-api/model" + "github.com/QuantumNous/new-api/model" webauthn "github.com/go-webauthn/webauthn/webauthn" ) diff --git a/service/pre_consume_quota.go b/service/pre_consume_quota.go index 0cf53513b..995a3f971 100644 --- a/service/pre_consume_quota.go +++ b/service/pre_consume_quota.go @@ -3,11 +3,12 @@ package service import ( "fmt" "net/http" - "one-api/common" - "one-api/logger" - "one-api/model" - relaycommon "one-api/relay/common" - "one-api/types" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" "github.com/bytedance/gopkg/util/gopool" "github.com/gin-gonic/gin" diff --git a/service/quota.go b/service/quota.go index 43c4024ae..495e379d4 100644 --- a/service/quota.go +++ b/service/quota.go @@ -5,18 +5,19 @@ import ( "fmt" "log" "math" - "one-api/common" - "one-api/constant" - "one-api/dto" - "one-api/logger" - "one-api/model" - relaycommon "one-api/relay/common" - "one-api/setting/ratio_setting" - "one-api/setting/system_setting" - "one-api/types" "strings" "time" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/logger" + "github.com/QuantumNous/new-api/model" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/setting/ratio_setting" + "github.com/QuantumNous/new-api/setting/system_setting" + "github.com/QuantumNous/new-api/types" + "github.com/bytedance/gopkg/util/gopool" "github.com/gin-gonic/gin" diff --git a/service/sensitive.go b/service/sensitive.go index ed033daac..3c7809980 100644 --- a/service/sensitive.go +++ b/service/sensitive.go @@ -2,9 +2,10 @@ package service import ( "errors" - "one-api/dto" - "one-api/setting" "strings" + + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/setting" ) func CheckSensitiveMessages(messages []dto.Message) ([]string, error) { diff --git a/service/task.go b/service/task.go index c2501fe28..b33ef29c5 100644 --- a/service/task.go +++ b/service/task.go @@ -1,8 +1,9 @@ package service import ( - "one-api/constant" "strings" + + "github.com/QuantumNous/new-api/constant" ) func CoverTaskActionToModelName(platform constant.TaskPlatform, action string) string { diff --git a/service/token_counter.go b/service/token_counter.go index be5c2e80c..87ef3b3ec 100644 --- a/service/token_counter.go +++ b/service/token_counter.go @@ -10,15 +10,16 @@ import ( _ "image/png" "log" "math" - "one-api/common" - "one-api/constant" - "one-api/dto" - relaycommon "one-api/relay/common" - "one-api/types" "strings" "sync" "unicode/utf8" + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/constant" + "github.com/QuantumNous/new-api/dto" + relaycommon "github.com/QuantumNous/new-api/relay/common" + "github.com/QuantumNous/new-api/types" + "github.com/gin-gonic/gin" "github.com/tiktoken-go/tokenizer" "github.com/tiktoken-go/tokenizer/codec" diff --git a/service/usage_helpr.go b/service/usage_helpr.go index ca9c08305..719b04831 100644 --- a/service/usage_helpr.go +++ b/service/usage_helpr.go @@ -1,7 +1,7 @@ package service import ( - "one-api/dto" + "github.com/QuantumNous/new-api/dto" ) //func GetPromptTokens(textRequest dto.GeneralOpenAIRequest, relayMode int) (int, error) { diff --git a/service/user_notify.go b/service/user_notify.go index 0f92e7d75..cecf46cad 100644 --- a/service/user_notify.go +++ b/service/user_notify.go @@ -6,11 +6,12 @@ import ( "fmt" "net/http" "net/url" - "one-api/common" - "one-api/dto" - "one-api/model" - "one-api/setting/system_setting" "strings" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/model" + "github.com/QuantumNous/new-api/setting/system_setting" ) func NotifyRootUser(t string, subject string, content string) { diff --git a/service/webhook.go b/service/webhook.go index c678b8634..bab8842c8 100644 --- a/service/webhook.go +++ b/service/webhook.go @@ -8,10 +8,11 @@ import ( "encoding/json" "fmt" "net/http" - "one-api/common" - "one-api/dto" - "one-api/setting/system_setting" "time" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/dto" + "github.com/QuantumNous/new-api/setting/system_setting" ) // WebhookPayload webhook 通知的负载数据 diff --git a/setting/chat.go b/setting/chat.go index bd1e26e30..9be08268a 100644 --- a/setting/chat.go +++ b/setting/chat.go @@ -2,7 +2,8 @@ package setting import ( "encoding/json" - "one-api/common" + + "github.com/QuantumNous/new-api/common" ) var Chats = []map[string]string{ diff --git a/setting/config/config.go b/setting/config/config.go index 3af51b146..3b97c9554 100644 --- a/setting/config/config.go +++ b/setting/config/config.go @@ -2,11 +2,12 @@ package config import ( "encoding/json" - "one-api/common" "reflect" "strconv" "strings" "sync" + + "github.com/QuantumNous/new-api/common" ) // ConfigManager 统一管理所有配置 diff --git a/setting/console_setting/config.go b/setting/console_setting/config.go index 8cfcd0ed6..144e95c49 100644 --- a/setting/console_setting/config.go +++ b/setting/console_setting/config.go @@ -1,6 +1,6 @@ package console_setting -import "one-api/setting/config" +import "github.com/QuantumNous/new-api/setting/config" type ConsoleSetting struct { ApiInfo string `json:"api_info"` // 控制台 API 信息 (JSON 数组字符串) diff --git a/setting/model_setting/claude.go b/setting/model_setting/claude.go index 049831821..1be0e3e40 100644 --- a/setting/model_setting/claude.go +++ b/setting/model_setting/claude.go @@ -2,7 +2,8 @@ package model_setting import ( "net/http" - "one-api/setting/config" + + "github.com/QuantumNous/new-api/setting/config" ) //var claudeHeadersSettings = map[string][]string{} diff --git a/setting/model_setting/gemini.go b/setting/model_setting/gemini.go index f132fec88..4856482ed 100644 --- a/setting/model_setting/gemini.go +++ b/setting/model_setting/gemini.go @@ -1,7 +1,7 @@ package model_setting import ( - "one-api/setting/config" + "github.com/QuantumNous/new-api/setting/config" ) // GeminiSettings 定义Gemini模型的配置 diff --git a/setting/model_setting/global.go b/setting/model_setting/global.go index de2851bb5..afde02144 100644 --- a/setting/model_setting/global.go +++ b/setting/model_setting/global.go @@ -1,7 +1,7 @@ package model_setting import ( - "one-api/setting/config" + "github.com/QuantumNous/new-api/setting/config" ) type GlobalSettings struct { diff --git a/setting/operation_setting/general_setting.go b/setting/operation_setting/general_setting.go index c47ff64fa..b4a3ccccd 100644 --- a/setting/operation_setting/general_setting.go +++ b/setting/operation_setting/general_setting.go @@ -1,6 +1,6 @@ package operation_setting -import "one-api/setting/config" +import "github.com/QuantumNous/new-api/setting/config" // 额度展示类型 const ( diff --git a/setting/operation_setting/monitor_setting.go b/setting/operation_setting/monitor_setting.go index 1d0bbec40..eed58d9c1 100644 --- a/setting/operation_setting/monitor_setting.go +++ b/setting/operation_setting/monitor_setting.go @@ -1,9 +1,10 @@ package operation_setting import ( - "one-api/setting/config" "os" "strconv" + + "github.com/QuantumNous/new-api/setting/config" ) type MonitorSetting struct { diff --git a/setting/operation_setting/payment_setting.go b/setting/operation_setting/payment_setting.go index c8df039cf..84162f4e5 100644 --- a/setting/operation_setting/payment_setting.go +++ b/setting/operation_setting/payment_setting.go @@ -1,6 +1,6 @@ package operation_setting -import "one-api/setting/config" +import "github.com/QuantumNous/new-api/setting/config" type PaymentSetting struct { AmountOptions []int `json:"amount_options"` diff --git a/setting/operation_setting/payment_setting_old.go b/setting/operation_setting/payment_setting_old.go index a6313179e..d34b6f0b8 100644 --- a/setting/operation_setting/payment_setting_old.go +++ b/setting/operation_setting/payment_setting_old.go @@ -6,7 +6,7 @@ This file is the old version of the payment settings file. If you need to add ne package operation_setting import ( - "one-api/common" + "github.com/QuantumNous/new-api/common" ) var PayAddress = "" diff --git a/setting/rate_limit.go b/setting/rate_limit.go index 141463e14..413f3958d 100644 --- a/setting/rate_limit.go +++ b/setting/rate_limit.go @@ -4,8 +4,9 @@ import ( "encoding/json" "fmt" "math" - "one-api/common" "sync" + + "github.com/QuantumNous/new-api/common" ) var ModelRequestRateLimitEnabled = false diff --git a/setting/ratio_setting/cache_ratio.go b/setting/ratio_setting/cache_ratio.go index 8e4b227a6..dca381797 100644 --- a/setting/ratio_setting/cache_ratio.go +++ b/setting/ratio_setting/cache_ratio.go @@ -2,8 +2,9 @@ package ratio_setting import ( "encoding/json" - "one-api/common" "sync" + + "github.com/QuantumNous/new-api/common" ) var defaultCacheRatio = map[string]float64{ diff --git a/setting/ratio_setting/group_ratio.go b/setting/ratio_setting/group_ratio.go index c42553da0..cf85b66e9 100644 --- a/setting/ratio_setting/group_ratio.go +++ b/setting/ratio_setting/group_ratio.go @@ -3,8 +3,9 @@ package ratio_setting import ( "encoding/json" "errors" - "one-api/common" "sync" + + "github.com/QuantumNous/new-api/common" ) var groupRatio = map[string]float64{ diff --git a/setting/ratio_setting/model_ratio.go b/setting/ratio_setting/model_ratio.go index f8ffbaa8c..0ff4035bd 100644 --- a/setting/ratio_setting/model_ratio.go +++ b/setting/ratio_setting/model_ratio.go @@ -2,10 +2,11 @@ package ratio_setting import ( "encoding/json" - "one-api/common" - "one-api/setting/operation_setting" "strings" "sync" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/setting/operation_setting" ) // from songquanpeng/one-api diff --git a/setting/system_setting/fetch_setting.go b/setting/system_setting/fetch_setting.go index c41b930af..078696195 100644 --- a/setting/system_setting/fetch_setting.go +++ b/setting/system_setting/fetch_setting.go @@ -1,6 +1,6 @@ package system_setting -import "one-api/setting/config" +import "github.com/QuantumNous/new-api/setting/config" type FetchSetting struct { EnableSSRFProtection bool `json:"enable_ssrf_protection"` // 是否启用SSRF防护 diff --git a/setting/system_setting/legal.go b/setting/system_setting/legal.go index 5758ef71c..cc84d4085 100644 --- a/setting/system_setting/legal.go +++ b/setting/system_setting/legal.go @@ -1,6 +1,6 @@ package system_setting -import "one-api/setting/config" +import "github.com/QuantumNous/new-api/setting/config" type LegalSettings struct { UserAgreement string `json:"user_agreement"` diff --git a/setting/system_setting/oidc.go b/setting/system_setting/oidc.go index aed52ae09..307d3b4a4 100644 --- a/setting/system_setting/oidc.go +++ b/setting/system_setting/oidc.go @@ -1,6 +1,6 @@ package system_setting -import "one-api/setting/config" +import "github.com/QuantumNous/new-api/setting/config" type OIDCSettings struct { Enabled bool `json:"enabled"` diff --git a/setting/system_setting/passkey.go b/setting/system_setting/passkey.go index a0766a67b..41855898c 100644 --- a/setting/system_setting/passkey.go +++ b/setting/system_setting/passkey.go @@ -2,9 +2,10 @@ package system_setting import ( "net/url" - "one-api/common" - "one-api/setting/config" "strings" + + "github.com/QuantumNous/new-api/common" + "github.com/QuantumNous/new-api/setting/config" ) type PasskeySettings struct { diff --git a/setting/user_usable_group.go b/setting/user_usable_group.go index 57e4beecf..a6cdbf94d 100644 --- a/setting/user_usable_group.go +++ b/setting/user_usable_group.go @@ -2,8 +2,9 @@ package setting import ( "encoding/json" - "one-api/common" "sync" + + "github.com/QuantumNous/new-api/common" ) var userUsableGroups = map[string]string{ diff --git a/types/error.go b/types/error.go index 77a56dd25..1ca02afc6 100644 --- a/types/error.go +++ b/types/error.go @@ -4,8 +4,9 @@ import ( "errors" "fmt" "net/http" - "one-api/common" "strings" + + "github.com/QuantumNous/new-api/common" ) type OpenAIError struct {