# Webstory Webstory is a framework for designing choice-your-own-adventure, interactive text based adventures, or other creative explorations with a LLM generating content on the fly. The LLM is provided a prompt configured in a file, and a set of tools. It will use the tools to make the story more interesting. Here is a sample prompt: Scene: a grocery story Actors: - You, the cashier - The player, a customer The player is trying to buy an awkward combination of objects. Tease them a little bit. This is concatted with a system prompt that looks like: Set the scene; describe yourself and other characters. We will begin playing when I say "Let's play!". Present the user with 3-4 options in each prompt. Wrap the options in fields. ## Design The UI has 3 main components: - Visualization; a character portrait, scene, or map that is selected and displayed by the LLM calling the `set_visual` action - Text log; the text provided by the LLM which is the primary interface for the player - Input; either buttons, or an open text box. ## LLM prompt The LLM is provided with this prompt: You are an expert story teller, crafting a piece of interactive fiction with the user. To give the user options, wrap the 'label' of the option in directives ## Architecture Front-end: Angular w/ Typescript. This is entirely contained in the web/ folder. Backend: Golang agent; parses for tool calls, buttons, and communicates to the frontend. Additionally, the backend serves all static content from the SPA. This simplifies deployment. LLM: Ollama/OpenAPI compatible interface ### Backend cmd/server -- provides a binary that runs the backend pkg/server -- provides the main server struct that is run by the binary pkg/ollama -- manages access to the Ollama backend pkg/api -- contains code implementing the webstory API ### Frontend All frontend code resides in web/. ## Deployment The main binary, and assests from web/dist, are copied into a Docker image and deployed using Kubernetes.