mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
V4.6.6-2 (#673)
This commit is contained in:
@@ -5,7 +5,7 @@ import { withNextCors } from '@fastgpt/service/common/middle/cors';
|
||||
import { pushGenerateVectorBill } from '@/service/support/wallet/bill/push';
|
||||
import { connectToDatabase } from '@/service/mongo';
|
||||
import { authTeamBalance } from '@/service/support/permission/auth/bill';
|
||||
import { getVectorsByText, GetVectorProps } from '@/service/core/ai/vector';
|
||||
import { getVectorsByText, GetVectorProps } from '@fastgpt/service/core/ai/embedding';
|
||||
import { updateApiKeyUsage } from '@fastgpt/service/support/openapi/tools';
|
||||
import { getBillSourceByAuthType } from '@fastgpt/global/support/wallet/bill/tools';
|
||||
|
||||
@@ -30,7 +30,7 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
|
||||
await authTeamBalance(teamId);
|
||||
|
||||
const { tokenLen, vectors } = await getVectorsByText({ input, model });
|
||||
const { tokens, vectors } = await getVectorsByText({ input, model });
|
||||
|
||||
jsonRes(res, {
|
||||
data: {
|
||||
@@ -42,8 +42,8 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
})),
|
||||
model,
|
||||
usage: {
|
||||
prompt_tokens: tokenLen,
|
||||
total_tokens: tokenLen
|
||||
prompt_tokens: tokens,
|
||||
total_tokens: tokens
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -51,7 +51,7 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
const { total } = pushGenerateVectorBill({
|
||||
teamId,
|
||||
tmbId,
|
||||
tokenLen,
|
||||
tokens,
|
||||
model,
|
||||
billId,
|
||||
source: getBillSourceByAuthType({ authType })
|
||||
|
@@ -42,11 +42,9 @@ export default withNextCors(async function handler(req: NextApiRequest, res: Nex
|
||||
data: result
|
||||
});
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
jsonRes<PostReRankResponse>(res, {
|
||||
data: inputs.map((input) => ({
|
||||
id: input.id
|
||||
}))
|
||||
jsonRes(res, {
|
||||
code: 500,
|
||||
error: err
|
||||
});
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user