fix custom world agent draft profile identity
This commit is contained in:
@@ -1763,10 +1763,16 @@ test('agent draft result auto-save persists the latest profile rebuilt from sync
|
||||
const latestSavedProfile = vi
|
||||
.mocked(upsertRpgWorldProfile)
|
||||
.mock.calls.at(-1)?.[0];
|
||||
const latestSaveRequest = vi
|
||||
.mocked(upsertRpgWorldProfile)
|
||||
.mock.calls.at(-1)?.[1];
|
||||
expect(latestSavedProfile?.name).toBe('潮雾列岛·session最新版');
|
||||
expect(latestSavedProfile?.summary).toBe(
|
||||
'作品库应该保存这份同步后的最新快照。',
|
||||
);
|
||||
expect(latestSaveRequest).toEqual({
|
||||
sourceAgentSessionId: 'custom-world-agent-session-1',
|
||||
});
|
||||
});
|
||||
|
||||
test('agent draft result can open from server result preview without embedded legacyResultProfile', async () => {
|
||||
|
||||
@@ -126,7 +126,15 @@ export function useRpgCreationResultAutosave(
|
||||
|
||||
try {
|
||||
const mutation =
|
||||
await upsertRpgWorldProfile(normalizedProfile);
|
||||
await upsertRpgWorldProfile(
|
||||
normalizedProfile,
|
||||
{
|
||||
sourceAgentSessionId:
|
||||
isAgentDraftResultView && activeAgentSessionId
|
||||
? activeAgentSessionId
|
||||
: null,
|
||||
},
|
||||
);
|
||||
if (latestAutoSaveRequestIdRef.current !== requestId) {
|
||||
return mutation;
|
||||
}
|
||||
@@ -159,7 +167,9 @@ export function useRpgCreationResultAutosave(
|
||||
}
|
||||
},
|
||||
[
|
||||
activeAgentSessionId,
|
||||
generatedCustomWorldProfile,
|
||||
isAgentDraftResultView,
|
||||
refreshCustomWorldWorks,
|
||||
setSavedCustomWorldEntries,
|
||||
setSelectedDetailEntry,
|
||||
|
||||
Reference in New Issue
Block a user