📝CHIM - Custom Prompts

Warning: file_put_contents(/var/www/html/HerikaServer/log/chim.log): Failed to open stream: No such file or directory in /opt/chim-herikaserver/lib/logger.php on line 171

Warning: file_put_contents(/opt/chim-herikaserver/prompts/prompts_custom.php): Failed to open stream: Permission denied in /opt/chim-herikaserver/ui/customprompteditor.php on line 37
📝CHIM - Custom Prompts

📝CHIM Custom Prompt Editor

Warning: For Advanced Users Only! Misconfigurations can cause CHIM to break in unexpected ways...

By making your own prompts_custom.php file you can make edits to how AI NPCs respond to triggered events.

The contents of this file overwrites whatever is in the standard prompts.php, meaning you can safely make edits to it without breaking it when CHIM updates.

The file must be in valid PHP format! Make sure it starts with <?php and ends with ?>.

Click the Validate button to confirm the file is in proper format. Then click Save.

Use an LLM chatbot if you need help fixing syntax errors.


How to Adjust the AI Prompts

We have this in prompts.php


    "combatend" => [
        "cue" => [
            "({$GLOBALS["HERIKA_NAME"]} comments about the last combat encounter) $TEMPLATE_DIALOG",
            "({$GLOBALS["HERIKA_NAME"]} laughs at {$GLOBALS["PLAYER_NAME"]}'s combat style) $TEMPLATE_DIALOG",
            "({$GLOBALS["HERIKA_NAME"]} comments about {$GLOBALS["PLAYER_NAME"]}'s weapons) $TEMPLATE_DIALOG",
            "({$GLOBALS["HERIKA_NAME"]} admires {$GLOBALS["PLAYER_NAME"]}'s combat style) $TEMPLATE_DIALOG"
        ],
        "extra" => [
            "mood" => "whispering",
            "force_tokens_max" => "50",
            "dontuse" => (time() % 5 != 0) // 20% chance
        ]
    ],

We can edit the prompts_custom.php with this new definition:


// These are comments, you do not need to add them to the custom prompt file.
// $TEMPLATE_DIALOG is in prompts.php and is the standard cue.
// Cue is the last instruction sent to the LLM.
// If cue is an array, a random cue will be chosen from that array.

// You can disable some events by adding this named key ["extra"]["dontuse"], so:
// * "dontuse" = true -> will disable the event
// * "dontuse" = (time() % 5 != 0) -> will disable the event 4 out of 5 times (20% chance)
// * "force_tokens_max" => will change token limit for this event
// * "mood" => will force mood
// End of comments.

$PROMPTS["combatend"] = [
    "cue" => [
        "({$GLOBALS["HERIKA_NAME"]} boasts that they have defeated all the enemies.) $TEMPLATE_DIALOG"
    ],
    "extra" => [
        "mood" => "whispering",
        "force_tokens_max" => "50",
        "dontuse" => (time() % 5 != 0) // 20% chance
    ]
],

Custom Prompt Examples:

Make diary entries more emotional and private (credit to Larrek)


$PROMPTS["diary"]=[ 
    "cue"=>["Please write a short summary of {$GLOBALS["PLAYER_NAME"]} and {$GLOBALS["HERIKA_NAME"]}'s last dialogues and events written above into {$GLOBALS["HERIKA_NAME"]}'s diary, add {$GLOBALS["HERIKA_NAME"]}'s emotions and private thoughts on people and events . WRITE AS IF YOU WERE {$GLOBALS["HERIKA_NAME"]}."],
    "extra"=>["force_tokens_max"=>0]
];