mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 03:48:24 +00:00
V4.6.6-1 (#656)
This commit is contained in:
@@ -60,7 +60,10 @@ export async function getVectorsByText({
|
||||
}
|
||||
|
||||
function unityDimensional(vector: number[]) {
|
||||
if (vector.length > 1536) return Promise.reject('向量维度不能超过 1536');
|
||||
if (vector.length > 1536) {
|
||||
console.log(`当前向量维度为: ${vector.length}, 向量维度不能超过 1536, 已自动截取前 1536 维度`);
|
||||
return vector.slice(0, 1536);
|
||||
}
|
||||
let resultVector = vector;
|
||||
const vectorLen = vector.length;
|
||||
|
||||
|
@@ -43,6 +43,9 @@ export async function generateVector(): Promise<any> {
|
||||
lockTime: new Date()
|
||||
}
|
||||
)
|
||||
.sort({
|
||||
weight: -1
|
||||
})
|
||||
.select({
|
||||
_id: 1,
|
||||
userId: 1,
|
||||
@@ -137,6 +140,7 @@ export async function generateVector(): Promise<any> {
|
||||
indexes: dataItem.indexes,
|
||||
model: data.model
|
||||
});
|
||||
|
||||
// push bill
|
||||
pushGenerateVectorBill({
|
||||
teamId: data.teamId,
|
||||
|
@@ -138,6 +138,9 @@ export const dispatchChatCompletion = async (props: ChatProps): Promise<ChatResp
|
||||
temperature,
|
||||
max_tokens,
|
||||
stream,
|
||||
presence_penalty: 0,
|
||||
frequency_penalty: 0,
|
||||
top_p: 1,
|
||||
// seed: temperature < 0.3 ? 1 : undefined,
|
||||
messages: concatMessages
|
||||
},
|
||||
|
@@ -258,9 +258,9 @@ export function pushReRankBill({
|
||||
if (!model) return { total: 0 };
|
||||
|
||||
const textLength = inputs.reduce((sum, item) => sum + item.text.length, 0);
|
||||
const ratio = Math.ceil(textLength / 1000);
|
||||
const ratio = textLength / 1000;
|
||||
|
||||
const total = model.price * PRICE_SCALE * ratio;
|
||||
const total = Math.ceil(model.price * PRICE_SCALE * ratio);
|
||||
const name = 'wallet.bill.ReRank';
|
||||
|
||||
createBill({
|
||||
@@ -274,7 +274,7 @@ export function pushReRankBill({
|
||||
moduleName: name,
|
||||
amount: total,
|
||||
model: model.name,
|
||||
tokenLen: 1
|
||||
tokenLen: textLength
|
||||
}
|
||||
]
|
||||
});
|
||||
|
Reference in New Issue
Block a user