mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-10 10:33:41 +08:00
Merge remote-tracking branch 'origin/upstream/main'
This commit is contained in:
@@ -23,7 +23,7 @@ ADD go.mod go.sum ./
|
|||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
COPY --from=builder /web/build ./web/build
|
COPY --from=builder /web/build ./web/build
|
||||||
RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
|
RUN go build -ldflags "-s -w -X 'github.com/songquanpeng/one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
|
||||||
|
|
||||||
FROM debian:bullseye
|
FROM debian:bullseye
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ func init() {
|
|||||||
})
|
})
|
||||||
// https://platform.openai.com/docs/models/model-endpoint-compatibility
|
// https://platform.openai.com/docs/models/model-endpoint-compatibility
|
||||||
for i := 0; i < constant.APITypeDummy; i++ {
|
for i := 0; i < constant.APITypeDummy; i++ {
|
||||||
|
if i == constant.APITypeAIProxyLibrary {
|
||||||
|
continue
|
||||||
|
}
|
||||||
adaptor := helper.GetAdaptor(i)
|
adaptor := helper.GetAdaptor(i)
|
||||||
if adaptor == nil {
|
if adaptor == nil {
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ func RelayTextHelper(c *gin.Context) *model.ErrorWithStatusCode {
|
|||||||
ratio := modelRatio * groupRatio
|
ratio := modelRatio * groupRatio
|
||||||
// pre-consume quota
|
// pre-consume quota
|
||||||
promptTokens := getPromptTokens(textRequest, meta.Mode)
|
promptTokens := getPromptTokens(textRequest, meta.Mode)
|
||||||
|
meta.PromptTokens = promptTokens
|
||||||
preConsumedQuota, bizErr := preConsumeQuota(ctx, textRequest, promptTokens, ratio, meta)
|
preConsumedQuota, bizErr := preConsumeQuota(ctx, textRequest, promptTokens, ratio, meta)
|
||||||
if bizErr != nil {
|
if bizErr != nil {
|
||||||
logger.Warnf(ctx, "preConsumeQuota failed: %+v", *bizErr)
|
logger.Warnf(ctx, "preConsumeQuota failed: %+v", *bizErr)
|
||||||
|
|||||||
Reference in New Issue
Block a user