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

@@ -28,7 +28,9 @@ export const pushBill = async ({
// 计算价格
const price = unitPrice * tokens.length;
console.log('token len:', tokens.length, 'price: ', `${formatPrice(price)}`);
console.log('token len:', tokens.length);
console.log('text len: ', text.length);
console.log('price: ', `${formatPrice(price)}`);
try {
// 插入 Bill 记录

View File

@@ -39,9 +39,9 @@ const ModelSchema = new Schema({
},
temperature: {
type: Number,
min: 1,
min: 0,
max: 10,
default: 5
default: 4
},
service: {
company: {

View File

@@ -1,6 +1,6 @@
import { Schema, model, models } from 'mongoose';
import { hashPassword } from '@/service/utils/tools';
import { PRICE_SCALE } from '@/utils/user';
import { PRICE_SCALE } from '@/constants/common';
const UserSchema = new Schema({
email: {

View File

@@ -28,11 +28,11 @@ export const jsonRes = <T = any>(
} else if (openaiError[error?.response?.statusText]) {
msg = openaiError[error.response.statusText];
}
// console.log(error?.response);
console.log('error->');
console.log('code:', error.code);
console.log('statusText:', error?.response?.statusText);
console.log('msg:', msg);
error?.response && console.log('chat err:', error?.response);
}
res.json({