mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-12 11:23:42 +08:00
refactor: add GetRatio to Adaptor
This commit is contained in:
@@ -3,13 +3,15 @@ package palm
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/songquanpeng/one-api/relay/adaptor"
|
||||
"github.com/songquanpeng/one-api/relay/adaptor/openai"
|
||||
"github.com/songquanpeng/one-api/relay/billing/ratio"
|
||||
"github.com/songquanpeng/one-api/relay/meta"
|
||||
"github.com/songquanpeng/one-api/relay/model"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Adaptor struct {
|
||||
@@ -58,8 +60,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,5 +1,7 @@
|
||||
package palm
|
||||
|
||||
var ModelList = []string{
|
||||
"PaLM-2",
|
||||
import "github.com/songquanpeng/one-api/relay/billing/ratio"
|
||||
|
||||
var RatioMap = map[string]ratio.Ratio{
|
||||
"PaLM-2": {Input: 0, Output: 0},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user