边缘世界 RimWorld

边缘世界 RimWorld

RimTalk
 此主题已被置顶,因此可能具有重要性
Juicy  [开发者] 9 月 17 日 下午 2:45
Fixing "Json deserialization failed for List"
What does this mean?
This error happens when the AI (LLM) returns a response that RimTalk cannot parse into JSON. In other words, the model didn’t follow the exact format required.

Why does it happen?
  • Smaller models (especially <4B) are more likely to output malformed or inconsistent JSON.
  • High temperature values (>0.7) make the model “creative” and less strict in following instructions.
  • The model may add narration, commentary, or a different structure instead of the expected JSON.

Where can I see the bad response?
Check the RimWorld log (Player.log or developer console). The log will show the exact text RimTalk failed to parse.

✅ Correct Format
RimTalk requires replies to be in this exact structure:

[ { "name": "Clarke", "text": "This darkness… it brings back unpleasant memories. Gabs, are you nearly finished with that roof?" } ]

Multiple dialogues can be included in one response, as long as it’s still a JSON array of objects:

[ { "name": "Clarke", "text": "This darkness… it brings back unpleasant memories. Gabs, are you nearly finished with that roof?" }, { "name": "Gabs", "text": "Master, almost done. Just a few more supports to secure… my arms ache." } ]

❌ Common Mistakes (will cause error)
  • Returning plain text (no [ or ]).
  • Returning a single JSON object instead of an array.
  • Using keys other than "name" and "text".
  • Adding commentary outside the JSON (like "Here’s the dialogue:").

🔧 How to fix it
  • Use a smarter model. Minimum size is 4B parameters, but even 4B can sometimes fail. Larger models are more reliable.
  • Keep your AI instruction and persona concise, within recommended limits. Longer prompts can make the model less likely to follow instructions and may slow down responses.
  • If using a smaller model, keep temperature ≤ 0.7.
  • Check that JSON/structured output is disabled (if supported). It’s recommended to keep it off unless you’re familiar with its use.
最后由 Juicy 编辑于; 9 月 17 日 下午 3:33
< >
正在显示第 1 - 8 条,共 8 条留言
SirMalFet 9 月 17 日 下午 3:17 
Any chance for an in-game toggle to use structured output? It would solve these problems for those using either the Gemma API or a local model that supports it.
Juicy  [开发者] 9 月 17 日 下午 4:48 
That’s a good suggestion. I may look into adding the toggle if more people encounter this issue.
SirMalFet 9 月 17 日 下午 8:14 
I can say that, while the talk works just fine, the Smart Gen fails due to this. It chains two requests, and the second one gives an answer "you are right, I can improve...", thus breaking it. This is with a fine-tune of Mistral 2509 Small.
Juicy  [开发者] 9 月 17 日 下午 10:46 
I’ve tweaked the prompt to improve JSON output. It should handle Smart Gen better now. Let me know if it still breaks.
月吟裔德格 9 月 18 日 上午 12:04 
After several attempts, I realized that my problem was caused by the prompts I newly added in the mod settings, which were copied from the previously used RimDialogue (and the original prompts of RimTalk were not deleted). Even after simplifying it into 4 sentences, errors still occasionally occurred on the 30B cloud model, but they were much fewer.
oniraji 9 月 18 日 上午 12:40 
Hello, I'd like to express my sincere gratitude for your hard work on the updates. Your mod has brought me so much joy. However, I still wish to remind you to check the settings for the Openrouter API provider in your mod's advanced configuration.
While playing, I correctly entered my Openrouter API key and selected the appropriate model. However, after your latest update, an error occurred where dialogues failed to generate. Upon checking the logs, I discovered the API request returned invalid JSON—specifically, an HTML page titled “Author not found.” I followed this troubleshooting guide but am nearly certain the issue isn't due to my model being too small, as I selected GPT-4o.
After changing the Openrouter option in Advanced Settings to “custom,” I manually entered the correct API key, model name, and URL, and the module worked normally.
I believe the issue likely lies with the URL!:dsfist:
Juicy  [开发者] 9 月 18 日 上午 7:00 
@oniraji Thanks! There was a bug in the OpenRouter path, but it should now be resolved.
SirMalFet 9 月 18 日 上午 11:03 
Unfortunately, it still does not work. The output includes example sentences and other information that makes the parser fail.


[RimTalk] Json deserialization failed for PersonalityData
{"persona": "A towering Jotun woman with a soft-spoken, gentle demeanor who always carries a handkerchief to discreetly wipe surfaces before touching them, speaking in measured tones while subtly policing others' hygiene habits with passive comments about 'germs' and 'cleanliness'.","chattiness": 0.7}_argumentLynx, a towering Jotun colonist, stands in the dusty corridor of her outpost, her massive frame casting a long shadow across the metal walls. Her hands, rough from years of labor, absently straighten a stack of supply crates while her amber eyes scan for any sign of disorder. She notices a smudge on a nearby console and, with a quiet sigh, produces a pristine handkerchief from her pocket, wiping it clean before resuming her work.A fellow colonist approaches, coughing loudly as they pass. Lynx's nostrils flare slightly at the sound, and she subtly increases her distance without breaking stride. "The filtration systems could use another check," she remarks, her voice deep but calm. "Dust accumulation concerns me."She pauses, her gaze fixed on a loose bolt near the floor. "Someone should tighten that before it becomes a hazard," she adds, her tone neutral but insistent. The handkerchief reappears, this time to adjust the collar of her jumpsuit—a ritualistic gesture that seems to ground her.As she moves further down the corridor, she spots a child running barefoot across the grated floor. Without hesitation, Lynx crouches (her movements surprisingly graceful for her size) and gently places a hand on the child's shoulder. "Shoes, please," she says, her voice carrying a note of firmness softened by concern. "The maintenance bots left metal shavings again."Straightening up, she resumes her patrol, her boots echoing with purpose. She stops at a supply closet, her fingers tracing the edges of the doorframe in a habitual check for cleanliness. "Restocking the medical supplies would be wise," she observes aloud, more to herself than anyone else. "And perhaps a thorough sterilization of the common areas."A faint smell of burnt circuitry drifts through the air. Lynx's jaw tightens almost imperceptibly, and she makes a mental note to remind the techs about proper maintenance protocols later. For now
< >
正在显示第 1 - 8 条,共 8 条留言
每页显示数: 1530 50