Skip to content

Commit

Permalink
chore: reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
Calcium-Ion committed Mar 15, 2024
1 parent 25ec999 commit d34b55c
Show file tree
Hide file tree
Showing 28 changed files with 5,779 additions and 5,845 deletions.
9 changes: 8 additions & 1 deletion common/model-ratio.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// TODO: when a new api is enabled, check the pricing here
// 1 === $0.002 / 1K tokens
// 1 === ¥0.014 / 1k tokens
var ModelRatio = map[string]float64{
var DefaultModelRatio = map[string]float64{
//"midjourney": 50,
"gpt-4-gizmo-*": 15,
"gpt-4": 15,
Expand Down Expand Up @@ -115,6 +115,7 @@ var DefaultModelPrice = map[string]float64{
}

var ModelPrice = map[string]float64{}
var ModelRatio = map[string]float64{}

func ModelPrice2JSONString() string {
if len(ModelPrice) == 0 {
Expand Down Expand Up @@ -150,6 +151,9 @@ func GetModelPrice(name string, printErr bool) float64 {
}

func ModelRatio2JSONString() string {
if len(ModelRatio) == 0 {
ModelRatio = DefaultModelRatio
}
jsonBytes, err := json.Marshal(ModelRatio)
if err != nil {
SysError("error marshalling model ratio: " + err.Error())
Expand All @@ -163,6 +167,9 @@ func UpdateModelRatioByJSONString(jsonStr string) error {
}

func GetModelRatio(name string) float64 {
if len(ModelRatio) == 0 {
ModelRatio = DefaultModelRatio
}
if strings.HasPrefix(name, "gpt-4-gizmo") {
name = "gpt-4-gizmo-*"
}
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
]
},
"devDependencies": {
"prettier": "^2.7.1",
"prettier": "2.8.8",
"typescript": "4.4.2"
},
"prettier": {
Expand Down
Loading

0 comments on commit d34b55c

Please sign in to comment.