Skip to content

Commit 6f9e14b

Browse files
committed
Proper error popup message when no workers are online, handle workers being offline for 30 seconds in case a worker needs to reconnect
1 parent 8c27b55 commit 6f9e14b

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

release/app/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentient-sims-app",
3-
"version": "1.4.6",
3+
"version": "1.4.7",
44
"description": "Companion app for the Sentient Sims mod",
55
"license": "MIT",
66
"author": {

src/__tests__/OpenAIService.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('OpenAIService', () => {
8282
const result = await openAIService.sentientSimsGenerate(promptRequest);
8383
console.log(result.text);
8484
expect(result.systemPrompt).toEqual(' ');
85-
expect(result.text.toLocaleLowerCase()).toContain('¿estás bien?');
85+
expect(result.text.toLocaleLowerCase()).toContain('bien?');
8686
}, 20000);
8787

8888
it('wants doesnt throw an error', async () => {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export enum SentientSimsHTTPStatusCode {
22
MAINTENANCE_MODE = 250,
33
NOT_MEMBER_EXCEPTION = 452,
4+
NO_WORKERS_EXCEPTION = 550,
45
}

src/main/sentient-sims/util/fetchWithRetries.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export async function fetchWithRetries(
1111
): Promise<any> {
1212
const response = await fetch(url, options);
1313

14+
log.debug(`response status: ${response.status}`);
15+
1416
switch (response.status) {
1517
case SentientSimsHTTPStatusCode.MAINTENANCE_MODE: {
1618
log.error('AI Server in maintenance mode');
@@ -22,6 +24,14 @@ export async function fetchWithRetries(
2224
'Sentient Sims AI Server is in maintenance mode, check #api-status in discord for details and try again later.'
2325
);
2426
}
27+
case SentientSimsHTTPStatusCode.NO_WORKERS_EXCEPTION: {
28+
log.error('No workers available');
29+
if (attempts < retries) {
30+
await new Promise((resolve) => setTimeout(resolve, delay));
31+
return fetchWithRetries(url, options, retries, delay, attempts + 1);
32+
}
33+
throw new Error('No AI workers available to service request.');
34+
}
2535
case SentientSimsHTTPStatusCode.NOT_MEMBER_EXCEPTION: {
2636
throw new Error(
2737
'Must be a Founder or Patron to use the Sentient Sims Uncensored AI Server.'

0 commit comments

Comments
 (0)