Fix DashScope env loading for scene image generation

This commit is contained in:
2026-04-06 15:01:15 +08:00
parent fcd8d727b0
commit d678929064
23 changed files with 4943 additions and 138 deletions

View File

@@ -412,6 +412,7 @@ function describeFrontEntity(
) {
const schema = resolveAttributeSchema(world, context.customWorldProfile);
if (context.encounterName) {
const encounterCustomProfile = context.encounterCustomProfile;
const encounterCharacter = context.encounterCharacterId
? getCharacterById(context.encounterCharacterId) ?? resolveEncounterRecruitCharacter({
characterId: context.encounterCharacterId,
@@ -427,11 +428,53 @@ function describeFrontEntity(
const attributeProfile = encounterCharacter
? resolveCharacterAttributeProfile(encounterCharacter, world, context.customWorldProfile)
: inferEncounterAttributeProfile(world, context, `encounter:${context.encounterName}`, [
inferEncounterPersonality(context.encounterContext, context.encounterDescription),
encounterCustomProfile?.personality ||
inferEncounterPersonality(
context.encounterContext,
context.encounterDescription,
),
encounterCustomProfile?.backstory ?? '',
encounterCustomProfile?.motivation ?? '',
encounterCustomProfile?.combatStyle ?? '',
...(encounterCustomProfile?.relationshipHooks ?? []),
...(encounterCustomProfile?.tags ?? []),
...(encounterCustomProfile?.backstoryReveal?.chapters ?? []).flatMap(
(chapter) => [
chapter.title,
chapter.teaser,
chapter.content,
chapter.contextSnippet,
],
),
...(encounterCustomProfile?.skills ?? []).flatMap((skill) => [
skill.name,
skill.summary,
skill.style,
]),
...(encounterCustomProfile?.initialItems ?? []).flatMap((item) => [
item.name,
item.category,
item.description,
...item.tags,
]),
]);
const title = encounterCharacter?.title ?? context.encounterContext ?? '此地生灵';
const description = encounterCharacter?.description ?? context.encounterDescription ?? '对方站在你面前,等待你进一步表态。';
const personality = encounterCharacter?.personality ?? inferEncounterPersonality(context.encounterContext, context.encounterDescription);
const title =
encounterCharacter?.title ??
encounterCustomProfile?.title ??
context.encounterContext ??
'此地生灵';
const description =
encounterCharacter?.description ??
encounterCustomProfile?.description ??
context.encounterDescription ??
'对方站在你面前,等待你进一步表态。';
const personality =
encounterCharacter?.personality ??
encounterCustomProfile?.personality ??
inferEncounterPersonality(
context.encounterContext,
context.encounterDescription,
);
const backstoryLines = encounterCharacter
? context.isFirstMeaningfulContact
? [getCharacterPublicBackstorySummary(encounterCharacter, world)]
@@ -440,7 +483,19 @@ function describeFrontEntity(
context.encounterAffinity ?? 0,
world,
)
: ['对方有自己的来路与立场,只是暂时没有完全表现出来。'];
: encounterCustomProfile
? [
encounterCustomProfile.backstoryReveal?.publicSummary ??
'对方有自己的来路与立场。',
encounterCustomProfile.backstory,
...(
encounterCustomProfile.backstoryReveal?.chapters.map(
(chapter) =>
chapter.contextSnippet || chapter.content || chapter.teaser,
) ?? []
),
].filter((line): line is string => Boolean(line))
: ['对方有自己的来路与立场,只是暂时没有完全表现出来。'];
const status = context.encounterKind === 'npc'
? context.isFirstMeaningfulContact
? '你们正在进行第一次真正接触,对方会先观察你的态度与来意。'
@@ -456,6 +511,31 @@ function describeFrontEntity(
`- 描述:${description}`,
...describeBackstoryContext('背景', backstoryLines).map(line => `- ${line}`),
`- 性格:${personality}`,
encounterCustomProfile?.motivation
? `- 当前动机:${encounterCustomProfile.motivation}`
: null,
encounterCustomProfile?.combatStyle
? `- 战斗风格:${encounterCustomProfile.combatStyle}`
: null,
encounterCustomProfile?.relationshipHooks?.length
? `- 关系切入口:${encounterCustomProfile.relationshipHooks.join('、')}`
: null,
encounterCustomProfile?.tags?.length
? `- 标签:${encounterCustomProfile.tags.join('、')}`
: null,
encounterCustomProfile?.skills?.length
? `- 自定义技能:${encounterCustomProfile.skills
.map((skill) => `${skill.name}(${skill.style})${skill.summary}`)
.join('')}`
: null,
encounterCustomProfile?.initialItems?.length
? `- 随身物:${encounterCustomProfile.initialItems
.map(
(item) =>
`${item.name}x${item.quantity}(${item.category}/${item.rarity})`,
)
.join('')}`
: null,
`- 世界属性框架:${buildSchemaSummary(schema).map(slot => `${slot.name}${slot.definition}`).join('、')}`,
...(encounterCharacter ? describeEncounterOpeningByStage(encounterCharacter, world, context).map(line => `- ${line}`) : []),