perf: code and inform

This commit is contained in:
archer
2023-07-04 21:24:32 +08:00
parent 8635de866f
commit 2a45fe520b
20 changed files with 97 additions and 163 deletions

View File

@@ -63,8 +63,9 @@ export async function generateQA(): Promise<any> {
// 请求 chatgpt 获取回答
const response = await Promise.all(
[data.q].map((text) =>
modelServiceToolMap[OpenAiChatEnum.GPT3516k]
modelServiceToolMap
.chatCompletion({
model: OpenAiChatEnum.GPT3516k,
apiKey: systemAuthKey,
temperature: 0.8,
messages: [

View File

@@ -0,0 +1,16 @@
export const startSendInform = async () => {
if (global.sendInformQueue.length === 0 || global.sendInformQueueLen > 0) return;
global.sendInformQueueLen++;
try {
const fn = global.sendInformQueue[global.sendInformQueue.length - 1];
await fn();
global.sendInformQueue.pop();
global.sendInformQueueLen--;
startSendInform();
} catch (error) {
global.sendInformQueueLen--;
startSendInform();
}
};