refactor to make a little more sense at a glance
This commit is contained in:
10
src/main.ts
10
src/main.ts
@ -116,7 +116,8 @@ const generateOllamaRequest = async (
|
|||||||
});
|
});
|
||||||
const ollamaResponse: OllamaResponse = await response.json();
|
const ollamaResponse: OllamaResponse = await response.json();
|
||||||
await storePromptData(notification, ollamaResponse);
|
await storePromptData(notification, ollamaResponse);
|
||||||
await postReplyToStatus(notification, ollamaResponse);
|
// await postReplyToStatus(notification, ollamaResponse);
|
||||||
|
return ollamaResponse;
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.message);
|
throw new Error(error.message);
|
||||||
@ -166,8 +167,11 @@ const postReplyToStatus = async (
|
|||||||
|
|
||||||
if (notifications) {
|
if (notifications) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
notifications.map((notification) => {
|
notifications.map(async (notification) => {
|
||||||
generateOllamaRequest(notification);
|
const ollamaResponse = await generateOllamaRequest(notification);
|
||||||
|
if (ollamaResponse) {
|
||||||
|
postReplyToStatus(notification, ollamaResponse);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user