feat: gpt3流响应

This commit is contained in:
archer
2023-03-25 20:43:03 +08:00
parent 6bba859060
commit 274ece1d91
12 changed files with 163 additions and 76 deletions

View File

@@ -1,5 +1,5 @@
import { PRICE_SCALE } from '@/constants/common';
const tokenKey = 'fast-gpt-token';
export const PRICE_SCALE = 100000;
export const setToken = (val: string) => {
localStorage.setItem(tokenKey, val);
@@ -14,6 +14,6 @@ export const clearToken = () => {
/**
* 把数据库读取到的price转化成元
*/
export const formatPrice = (val: number) => {
return val / PRICE_SCALE;
export const formatPrice = (val: number, multiple = 1) => {
return Number(((val / PRICE_SCALE) * multiple).toFixed(10));
};