mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-12 19:33:41 +08:00
refactor: add GetRatio to Adaptor
This commit is contained in:
@@ -3,11 +3,13 @@ package ollama
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/songquanpeng/one-api/relay/meta"
|
||||
"github.com/songquanpeng/one-api/relay/relaymode"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/songquanpeng/one-api/relay/billing/ratio"
|
||||
"github.com/songquanpeng/one-api/relay/meta"
|
||||
"github.com/songquanpeng/one-api/relay/relaymode"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/songquanpeng/one-api/relay/adaptor"
|
||||
"github.com/songquanpeng/one-api/relay/model"
|
||||
@@ -73,8 +75,12 @@ func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, meta *meta.Met
|
||||
return
|
||||
}
|
||||
|
||||
func (a *Adaptor) GetRatio(meta *meta.Meta) *ratio.Ratio {
|
||||
return adaptor.GetRatioHelper(meta, RatioMap)
|
||||
}
|
||||
|
||||
func (a *Adaptor) GetModelList() []string {
|
||||
return ModelList
|
||||
return adaptor.GetModelListHelper(RatioMap)
|
||||
}
|
||||
|
||||
func (a *Adaptor) GetChannelName() string {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package ollama
|
||||
|
||||
var ModelList = []string{
|
||||
"codellama:7b-instruct",
|
||||
"llama2:7b",
|
||||
"llama2:latest",
|
||||
"llama3:latest",
|
||||
"phi3:latest",
|
||||
"qwen:0.5b-chat",
|
||||
"qwen:7b",
|
||||
import "github.com/songquanpeng/one-api/relay/billing/ratio"
|
||||
|
||||
var RatioMap = map[string]ratio.Ratio{
|
||||
"codellama:7b-instruct": {Input: 0, Output: 0},
|
||||
"llama2:7b": {Input: 0, Output: 0},
|
||||
"llama2:latest": {Input: 0, Output: 0},
|
||||
"llama3:latest": {Input: 0, Output: 0},
|
||||
"phi3:latest": {Input: 0, Output: 0},
|
||||
"qwen:0.5b-chat": {Input: 0, Output: 0},
|
||||
"qwen:7b": {Input: 0, Output: 0},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user