mirror of
https://github.com/coaidev/coai.git
synced 2025-05-22 22:40:14 +09:00
update prize
This commit is contained in:
parent
db711fbf31
commit
2c28c9b9e6
@ -1,7 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { Model } from "./conversation/types.ts";
|
import { Model } from "./conversation/types.ts";
|
||||||
|
|
||||||
export const version = "3.5.1";
|
export const version = "3.5.2";
|
||||||
export const dev: boolean = window.location.hostname === "localhost";
|
export const dev: boolean = window.location.hostname === "localhost";
|
||||||
export const deploy: boolean = true;
|
export const deploy: boolean = true;
|
||||||
export let rest_api: string = "http://localhost:8094";
|
export let rest_api: string = "http://localhost:8094";
|
||||||
|
@ -45,11 +45,15 @@ import { Badge } from "../components/ui/badge.tsx";
|
|||||||
import { buySubscription } from "../conversation/addition.ts";
|
import { buySubscription } from "../conversation/addition.ts";
|
||||||
|
|
||||||
function calc_prize(month: number): number {
|
function calc_prize(month: number): number {
|
||||||
if (month >= 12) {
|
const base = 32 * month;
|
||||||
return 8 * month * 0.8;
|
if (month >= 36) {
|
||||||
|
return base * 0.7;
|
||||||
|
} else if (month >= 12) {
|
||||||
|
return base * 0.8;
|
||||||
} else if (month >= 6) {
|
} else if (month >= 6) {
|
||||||
return 8 * month * 0.9;
|
return base * 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 8 * month;
|
return 8 * month;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,14 +102,14 @@ const resources = {
|
|||||||
free: "Free",
|
free: "Free",
|
||||||
"free-price": "Free Forever",
|
"free-price": "Free Forever",
|
||||||
pro: "Pro",
|
pro: "Pro",
|
||||||
"pro-price": "8 CNY/Month",
|
"pro-price": "32 CNY/Month",
|
||||||
"free-gpt3": "GPT-3.5 (16k) Free Forever",
|
"free-gpt3": "GPT-3.5 (16k) Free Forever",
|
||||||
"free-dalle": "5 free quotas per day",
|
"free-dalle": "5 free quotas per day",
|
||||||
"free-web": "web searching feature",
|
"free-web": "web searching feature",
|
||||||
"free-conversation": "conversation storage",
|
"free-conversation": "conversation storage",
|
||||||
"free-api": "API calls",
|
"free-api": "API calls",
|
||||||
"pro-gpt4": "GPT-4 50 requests per day",
|
"pro-gpt4": "GPT-4 50 requests per day",
|
||||||
"pro-dalle": "50 quotas per day",
|
"pro-dalle": "2000 quotas per day",
|
||||||
"pro-service": "Priority Service Support",
|
"pro-service": "Priority Service Support",
|
||||||
"pro-thread": "Concurrency Increase",
|
"pro-thread": "Concurrency Increase",
|
||||||
current: "Current Plan",
|
current: "Current Plan",
|
||||||
@ -287,14 +287,14 @@ const resources = {
|
|||||||
free: "免费版",
|
free: "免费版",
|
||||||
"free-price": "永久免费",
|
"free-price": "永久免费",
|
||||||
pro: "专业版",
|
pro: "专业版",
|
||||||
"pro-price": "8 元/月",
|
"pro-price": "32 元/月",
|
||||||
"free-gpt3": "GPT-3.5 (16k) 永久免费",
|
"free-gpt3": "GPT-3.5 (16k) 永久免费",
|
||||||
"free-dalle": "每日 5 次免费绘图",
|
"free-dalle": "每日 5 次免费绘图",
|
||||||
"free-web": "联网搜索功能",
|
"free-web": "联网搜索功能",
|
||||||
"free-conversation": "对话存储记录",
|
"free-conversation": "对话存储记录",
|
||||||
"free-api": "API 调用",
|
"free-api": "API 调用",
|
||||||
"pro-gpt4": "GPT-4 每日请求 50 次",
|
"pro-gpt4": "GPT-4 每日请求 50 次",
|
||||||
"pro-dalle": "每日 50 次绘图",
|
"pro-dalle": "每日 2000 次绘图",
|
||||||
"pro-service": "优先服务支持",
|
"pro-service": "优先服务支持",
|
||||||
"pro-thread": "并发数提升",
|
"pro-thread": "并发数提升",
|
||||||
current: "当前计划",
|
current: "当前计划",
|
||||||
@ -476,14 +476,14 @@ const resources = {
|
|||||||
free: "Бесплатно",
|
free: "Бесплатно",
|
||||||
"free-price": "Бесплатно навсегда",
|
"free-price": "Бесплатно навсегда",
|
||||||
pro: "Профессиональный",
|
pro: "Профессиональный",
|
||||||
"pro-price": "8 CNY/месяц",
|
"pro-price": "32 CNY/месяц",
|
||||||
"free-gpt3": "GPT-3.5 (16k) бесплатно навсегда",
|
"free-gpt3": "GPT-3.5 (16k) бесплатно навсегда",
|
||||||
"free-dalle": "5 бесплатных квот в день",
|
"free-dalle": "5 бесплатных квот в день",
|
||||||
"free-web": "веб-поиск",
|
"free-web": "веб-поиск",
|
||||||
"free-conversation": "хранение разговоров",
|
"free-conversation": "хранение разговоров",
|
||||||
"free-api": "API вызовы",
|
"free-api": "API вызовы",
|
||||||
"pro-gpt4": "GPT-4 50 запросов в день",
|
"pro-gpt4": "GPT-4 50 запросов в день",
|
||||||
"pro-dalle": "50 квот в день",
|
"pro-dalle": "2000 квот в день",
|
||||||
"pro-service": "Приоритетная служба поддержки",
|
"pro-service": "Приоритетная служба поддержки",
|
||||||
"pro-thread": "Увеличение параллелизма",
|
"pro-thread": "Увеличение параллелизма",
|
||||||
current: "Текущая подписка",
|
current: "Текущая подписка",
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func CountSubscriptionPrize(month int) float32 {
|
func CountSubscriptionPrize(month int) float32 {
|
||||||
base := 8 * float32(month)
|
base := 32 * float32(month)
|
||||||
if month >= 36 {
|
if month >= 36 {
|
||||||
return base * 0.7
|
return base * 0.7
|
||||||
} else if month >= 12 {
|
} else if month >= 12 {
|
||||||
@ -51,7 +51,7 @@ func CanEnableSubscription(db *sql.DB, cache *redis.Client, user *User) bool {
|
|||||||
|
|
||||||
func GetDalleUsageLimit(db *sql.DB, user *User) int {
|
func GetDalleUsageLimit(db *sql.DB, user *User) int {
|
||||||
if user.IsSubscribe(db) {
|
if user.IsSubscribe(db) {
|
||||||
return 50
|
return 2000
|
||||||
}
|
}
|
||||||
return 5
|
return 5
|
||||||
}
|
}
|
||||||
|
@ -128,6 +128,8 @@ func ChatHandler(conn *Connection, user *auth.User, instance *conversation.Conve
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err != nil && err.Error() != "signal" {
|
if err != nil && err.Error() != "signal" {
|
||||||
|
fmt.Println(fmt.Sprintf("caught error from chat handler: %s (instance: %s, client: %s)", err, model, conn.GetCtx().ClientIP()))
|
||||||
|
|
||||||
CollectQuota(conn.GetCtx(), user, buffer.GetQuota(), reversible)
|
CollectQuota(conn.GetCtx(), user, buffer.GetQuota(), reversible)
|
||||||
conn.Send(globals.ChatSegmentResponse{
|
conn.Send(globals.ChatSegmentResponse{
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -119,6 +120,9 @@ func EventSource(method string, uri string, headers map[string]string, body inte
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if res.StatusCode >= 400 {
|
||||||
|
return fmt.Errorf("request failed with status: %s", res.Status)
|
||||||
|
}
|
||||||
|
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
for {
|
for {
|
||||||
|
@ -105,7 +105,7 @@ func CountInputToken(model string, v []globals.Message) float32 {
|
|||||||
case globals.GPT3Turbo16k:
|
case globals.GPT3Turbo16k:
|
||||||
return 0
|
return 0
|
||||||
case globals.GPT4:
|
case globals.GPT4:
|
||||||
return float32(CountTokenPrice(v, model)) / 1000 * 2.1 * 0.5
|
return float32(CountTokenPrice(v, model)) / 1000 * 2.1
|
||||||
case globals.GPT432k:
|
case globals.GPT432k:
|
||||||
return float32(CountTokenPrice(v, model)) / 1000 * 4.2
|
return float32(CountTokenPrice(v, model)) / 1000 * 4.2
|
||||||
case globals.SparkDesk:
|
case globals.SparkDesk:
|
||||||
@ -130,7 +130,7 @@ func CountOutputToken(model string, t int) float32 {
|
|||||||
case globals.GPT3Turbo16k:
|
case globals.GPT3Turbo16k:
|
||||||
return 0
|
return 0
|
||||||
case globals.GPT4:
|
case globals.GPT4:
|
||||||
return float32(t*GetWeightByModel(model)) / 1000 * 4.3 * 0.5
|
return float32(t*GetWeightByModel(model)) / 1000 * 4.3
|
||||||
case globals.GPT432k:
|
case globals.GPT432k:
|
||||||
return float32(t*GetWeightByModel(model)) / 1000 * 8.6
|
return float32(t*GetWeightByModel(model)) / 1000 * 8.6
|
||||||
case globals.SparkDesk:
|
case globals.SparkDesk:
|
||||||
|
Loading…
Reference in New Issue
Block a user