Files
talemate/src/talemate/commands/cmd_rebuild_archive.py
FInalWombat 72202dee02 Prep 0.12.0 (#26)
* no " or * just treat as spoken words

* chromadb perist to db

* collect name should contain embedding so switching between chromadb configurations doesn't brick your scenes

* fix save-as long term memory transfer

* add chroma

* director agent refactor

* tweak director command, prompt reset, ux display

* tweak director message ux

* allow clearing of prompt log

* remove auto adding of quotes if neither quote or * are present

* command to reset long term memory for the scene

* improve summarization template as it would cause some llms to add extra details

* rebuilding history will now also rebuild long term memory

* direct scene template

* fix scene time reset

* dialogue template tweaks

* better dialog format fixing

* some dialogue template adjustments

* adjust default values of director agent

* keep track of scene saved/unsaved status and confirm loading a different scene if current scene is unsaved

* prompt fixes

* remove the collection on recommitting the seen to memory, as the embeddings may have changed

* change to the official python api for the openai client and make it async

* prompt tweaks

* world state prompt parsing fixes

* improve handling of json responses

* 0 seconds ago changed to moments ago

* move memory context closer to scene

* token counts for openai client

* narrator agent option: narrate passage of time

* gitignore

* remove memory id

* refactor world state with persistence to chromadb (wip)

* remove world state update instructions

* dont display blank emotion in world state

* openai gpt-4 turbo support

* conversation agent extra instructions

* track prompt response times

* Yi and UtopiaXL

* long term memory retrieval improvements during conversations

* narrate scene tweaks

* conversation ltm augment tweaks

* hide subconfig if parent config isnt enabled

* ai assisted memory recall during conversation default to off

* openai json_object coersion only on model that supports it

openai client emit prompt processing time

* 0.12.0

* remove prompt number from prompt debug list

* add prompt number back in but shift it to the upper row

* narrate time passage hard content limit restriction for now as gpt-4
would just write a whole chapter.

* relock
2023-11-10 22:45:50 +02:00

36 lines
926 B
Python

import asyncio
from talemate.commands.base import TalemateCommand
from talemate.commands.manager import register
@register
class CmdRebuildArchive(TalemateCommand):
"""
Command class for the 'rebuild_archive' command
"""
name = "rebuild_archive"
description = "Rebuilds the archive of the scene"
aliases = ["rebuild"]
async def run(self):
summarizer = self.scene.get_helper("summarizer")
if not summarizer:
self.system_message("No summarizer found")
return True
# clear out archived history, but keep pre-established history
self.scene.archived_history = [
ah for ah in self.scene.archived_history if ah.get("end") is None
]
while True:
more = await summarizer.agent.build_archive(self.scene)
if not more:
break
await self.scene.commit_to_memory()