Skip to content

Commit e0bc427

Browse files
committed
feat: fix pr
1 parent 2f0fc4c commit e0bc427

4 files changed

Lines changed: 29 additions & 22 deletions

File tree

apps/webuiapps/src/components/ChatPanel/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,10 @@ const ChatPanel: React.FC<{ onClose: () => void; visible?: boolean }> = ({
425425
loadMemories(sessionPath).then(setMemories);
426426
}, [sessionPath, modCollection, seedPrologue]);
427427

428-
// Load configs from file (async override)
428+
// Load configs from file (async override).
429+
// Empty deps [] is intentional: configs (character collection, mod collection,
430+
// chat config, image-gen config) are loaded inside the effect and written to
431+
// state — they are not external dependencies that should trigger re-runs.
429432
useEffect(() => {
430433
loadConfig().then((fileConfig) => {
431434
if (fileConfig) setConfig(fileConfig);

apps/webuiapps/src/lib/characterManager.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ function migrateOldFormat(): CharacterCollection | null {
187187
return collection;
188188
}
189189
}
190-
} catch {
191-
// ignore
190+
} catch (e) {
191+
console.warn('[CharacterManager] migrateOldFormat failed:', e);
192192
}
193193
return null;
194194
}
@@ -203,8 +203,8 @@ export async function loadCharacterCollection(): Promise<CharacterCollection | n
203203
return data as CharacterCollection;
204204
}
205205
}
206-
} catch {
207-
// API not available
206+
} catch (e) {
207+
console.warn('[CharacterManager] loadCharacterCollection API not available:', e);
208208
}
209209
return null;
210210
}
@@ -216,8 +216,8 @@ export function loadCharacterCollectionSync(): CharacterCollection | null {
216216
const parsed = JSON.parse(raw);
217217
if (parsed.activeId && parsed.items) return parsed as CharacterCollection;
218218
}
219-
} catch {
220-
// ignore
219+
} catch (e) {
220+
console.warn('[CharacterManager] loadCharacterCollectionSync failed:', e);
221221
}
222222
return migrateOldFormat();
223223
}
@@ -230,8 +230,8 @@ export async function saveCharacterCollection(collection: CharacterCollection):
230230
headers: { 'Content-Type': 'application/json' },
231231
body: JSON.stringify(collection),
232232
});
233-
} catch {
234-
// Silently ignore
233+
} catch (e) {
234+
console.warn('[CharacterManager] saveCharacterCollection failed:', e);
235235
}
236236
}
237237

@@ -367,11 +367,6 @@ export function clearEmotionVideoCache(characterId?: string): void {
367367
}
368368
}
369369

370-
/** @deprecated Use resolveEmotionMedia instead */
371-
export function resolveEmotionImage(config: CharacterConfig, emotion?: string): string | undefined {
372-
return resolveEmotionMedia(config, emotion)?.url;
373-
}
374-
375370
export function getCharacterPromptContext(config: CharacterConfig): string {
376371
return (
377372
`You are ${config.character_name}, a ${config.character_gender_desc} character.\n` +

apps/webuiapps/src/lib/diskStorage.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ export async function listFiles(dirPath: string): Promise<{
4242
return await res.json();
4343
}
4444
return { files: [], not_exists: true };
45-
} catch {
45+
} catch (e) {
46+
console.warn('[diskStorage] listFiles failed:', e);
4647
return { files: [], not_exists: true };
4748
}
4849
}
@@ -60,7 +61,8 @@ export async function getFile(filePath: string): Promise<unknown> {
6061
} catch {
6162
return text;
6263
}
63-
} catch {
64+
} catch (e) {
65+
console.warn('[diskStorage] getFile failed:', e);
6466
return null;
6567
}
6668
}
@@ -81,8 +83,8 @@ export async function putTextFilesByJSON(data: {
8183
headers: { 'Content-Type': 'text/plain' },
8284
body: file.content || '',
8385
});
84-
} catch {
85-
// silently ignore
86+
} catch (e) {
87+
console.warn('[diskStorage] putTextFilesByJSON write failed:', e);
8688
}
8789
});
8890
await Promise.all(promises);
@@ -140,7 +142,8 @@ export async function searchFiles(data: { query: string }): Promise<unknown[]> {
140142
parentId: null,
141143
metadata: { size: f.size || 0 },
142144
}));
143-
} catch {
145+
} catch (e) {
146+
console.warn('[diskStorage] searchFiles failed:', e);
144147
return [];
145148
}
146149
}

apps/webuiapps/src/lib/modManager.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,10 @@ export class ModManager {
440440

441441
for (const id of targetIds) {
442442
if (validTargets.includes(id) && !this.state.completed_targets.includes(id)) {
443-
this.state.completed_targets.push(id);
443+
this.state = {
444+
...this.state,
445+
completed_targets: [...this.state.completed_targets, id],
446+
};
444447
newlyCompleted.push(id);
445448
}
446449
}
@@ -460,10 +463,13 @@ export class ModManager {
460463

461464
// Stage complete — advance
462465
const completedStage = { index: stage.stage_index, name: stage.stage_name };
463-
this.state.current_stage_index++;
466+
this.state = {
467+
...this.state,
468+
current_stage_index: this.state.current_stage_index + 1,
469+
};
464470

465471
if (this.state.current_stage_index >= this.config.stage_count) {
466-
this.state.is_finished = true;
472+
this.state = { ...this.state, is_finished: true };
467473
return {
468474
message: `Stage "${stage.stage_name}" completed! All stages finished!`,
469475
stageCompleted: true,

0 commit comments

Comments
 (0)