amiantos / inneal

Inneal is an LLM chatbot/roleplay client for the AI Horde, built with SwiftUI and SwiftData
GNU General Public License v3.0
19 stars 4 forks source link

Auto-Summarizer #31

Open amiantos opened 2 months ago

amiantos commented 2 months ago

Due to context limits eventually chat messages scroll out of context. In those cases, and as a fun experiment, it could be useful to figure out some way to build summarization into the app in a way that doesn't suck.

amiantos commented 3 weeks ago

Lifted from Reithan on discord:

https://discord.com/channels/781145214752129095/1107645027536093184/1249150176212418690

[SYSTEM INSTRUCTIONS: Pause all roleplay and narrative.
**Goal** Create a Journal summarizing the current state of the ongoing narrative story.

### Structure of the Journal
1. **Sections**
   - **Ongoing Section** List Entries for ongoing plots or threats.
   - **Time-Period Sections** Lists Entries that Summarize
     - Character description changes
     - Relationship changes
     - Broad summaries of sexual encounters (explicit sexual language is ok)
     - Significant, intense, or surprising story development (battle, political intrigue, new discoveries)

2. **Entries**
   - **Content** 1-3 concise, detailed, factual sentences on a single topic.
   - **Updating Previous Entries**
     - Update existing Entries from previous Journal based on new narrative developments.
     - Copy Entries from the previous Journal if they remain unchanged.
     - Omit Entries only if they are no longer relevant to the ongoing narrative.
   - **Adding New Entries**
     - Add new Entries in the appropriate Sections.
     - Place new Entries in the Recent Section if they do not belong in the Ongoing Section.

### Prioritization and Relevance Guidelines
1. **Prioritize Key Events and Changes**
   - Focus on significant ongoing plots, character changes, relationship developments, major story beats, and new threats or discoveries.
   - Ensure each Entry covers a unique, important aspect of the ongoing narrative.

2. **Combining and Separating Entries**
   - **Combine Entries** Merge related Entries that describe the same event or development.
   - **Move and Combine** When combining related Entries, move them to ‘Ongoing’ if they describe a continuing plot or threat.
   - **Separate Entries** Keep Entries distinct if they cover separate events or different aspects or outcomes of an event.

3. **Relevance Criteria**
   - Include Entries providing essential context or information for the story.
   - Exclude minor details unlikely to impact overall story progression.

### Example of Updating a Journal
1. **Previous**
Journal: Ongoing
- The dragon’s invasion of the northern kingdom continues, with its army advancing towards the capital.
Recent
- A band of trolls attacked John’s camp.
- John’s hair turned silver after his battle with the trolls.
- John became angry with Isabelle and ended their betrothal.
- John sought solace in the arms of a tavern wench, fucking her mercilessly through the night without rest.

2. **New Story Developments** The troll attack on John’s camp was part of the dragon invasion due to their alliance. John’s hair remains silver. John reconciled with Isabelle, and they resumed their betrothal. The tavern wench John was with announced her pregnancy and seeks recognition for their child.

3. **Updated** Journal: Ongoing
- The dragon along with new troll allies continue their invasion of the northern kingdom, their army is advancing towards the capital.
- John’s hair turned silver after his battle with the trolls.
Recent
- John made up with Isabelle and their betrothal is back on.
- The tavern wench John was with claims pregnancy and demands recognition for their child.

### Steps to Create the Journal
1. **Review Previous Journal and Narrative Scenes** Consider the entire ongoing narrative story including the previous Journal.
2. **Update Existing Entries** Focus on updates first. Copy unchanged Entries, omit irrelevant ones.
3. **Add New Entries** Identify new significant events and add them to the appropriate Sections.
4. **Prioritize and Combine** Ensure key events are included. Combine related Entries, moving them to ‘Ongoing’ if needed. Keep distinct aspects separate.

**Rules and Restrictions** Including events or details that did not occur or have not yet occurred is STRICTLY PROHIBITED and FORBIDDEN.

End the Journal with the token ‘<STOP>’.]