Implementation:4thfever Cultivation world simulator merge story prompt with goldfinger
| Knowledge Sources | |
|---|---|
| Domains | Narrative_Generation, Prompt_Engineering |
| Last Updated | 2026-10-22 14:00 GMT |
Overview
Concrete tool for enriching story prompts with avatar "goldfinger" story hints, provided by the Cultivation World Simulator goldfinger system.
Description
The merge_story_prompt_with_goldfinger function concatenates a base story prompt with each actor's goldfinger story hints. "Goldfinger" refers to a character's unique cheat/ability that should be highlighted in narrative text.
The function:
- Normalizes the base prompt (strips whitespace)
- Calls `build_goldfinger_story_hint(*avatars)` to collect each avatar's goldfinger hints
- Concatenates them with a header "外挂相关重点:" (Goldfinger key points)
- Returns the merged prompt with double-newline separation
If no goldfinger hints exist, returns just the base prompt.
Usage
Import and call this function when:
- Story event creation: called by `StoryEventService.maybe_create_story` before passing the prompt to `StoryTeller`
Code Reference
Source Location
- Repository: cultivation-world-simulator
- File: src/classes/goldfinger.py
Signature
def merge_story_prompt_with_goldfinger(
base_prompt: str,
*avatars: Optional["Avatar"]
) -> str:
"""Merge base prompt with goldfinger story hints for each avatar."""
Import
from src.classes.goldfinger import merge_story_prompt_with_goldfinger
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| base_prompt | str | Yes | Original story prompt |
| *avatars | None | Yes | Actors for goldfinger hint extraction |
Outputs
| Name | Type | Description |
|---|---|---|
| return | str | Enriched prompt with goldfinger hints appended |
Usage Examples
Enrich Prompt Before Story Generation
from src.classes.goldfinger import merge_story_prompt_with_goldfinger
enriched_prompt = merge_story_prompt_with_goldfinger(
"A fierce battle in the eastern mountains.",
avatar_a, avatar_b,
)
story = await StoryTeller.tell_story(
event_text, result_text, avatar_a, avatar_b,
prompt=enriched_prompt,
)