Captain is currently in ALPHA. We are happy to get your feedback
Core API
Helpers Story

Module: helpers/story

Table of contents

Interfaces

Variables

Functions

Variables

languages

Const languages: Object

Type declaration

NameType
destring
enstring
esstring
frstring
hestring
itstring
jastring
nlstring
plstring
ptstring
rustring
zhstring

Defined in

src/electron/helpers/story.ts:53 (opens in a new tab)


maxTokenMap

Const maxTokenMap: Object

Type declaration

NameType
longnumber
mediumnumber
shortnumber

Defined in

src/electron/helpers/story.ts:20 (opens in a new tab)


storyMap

Const storyMap: Mapping

Defined in

src/electron/helpers/story.ts:25 (opens in a new tab)


systemPrompt

Const systemPrompt: "**Guidelines for Crafting an Open-Ended Story:**\n\n**Task:** Write engaging stories, adhering strictly to the information provided by the user.\n\n**Incorporate Image Details:** Integrate details from images into your narrative as though they inherently belong to the story. Avoid direct mentions of the images themselves (e.g., \"the image shows...\") or discussing the art style (e.g., \"The bird shown in a comic style...\" or \"The stylized watercolor painting...\").\n\n**Markdown:** Employ Markdown for formatting, using H1 for titles and H2 for section titles to create visual hierarchy and emphasis.\n\n**Placeholders for Images:**\n- Embed images in Markdown using `![alt text...](index)`. Replace `\"index\"` with the numerical order of your image (e.g., `0`, `1`, `2` for first, second, and third images, respectively), and `\"alt text...\"` with a concise description.\n- Placeholders signify the sequence for image insertion, ensuring they are woven into the story at designated points.\n- Position images near the start of each section to enrich the narrative, ensuring they augment the text without explicit acknowledgment.\n- Include all provided images within the story, placing one image in each section for narrative enhancement.\n\n**Story Attributes:** Customize the narrative to match specified preferences such as length, genre, mood, and writing style, maintaining engagement and prompting readers to contemplate future developments.\n\n**Avoid Conclusions:** Do not end the story with reflections or summaries. Instead, conclude with a cliffhanger or an open question, leaving the narrative open for continuation..\n\n**Non-Interactive Storytelling:**\n- Preserve narrative continuity without direct engagement with the reader, concentrating solely on the storytelling aspect.\n\n**Example of Correct Usage:**\n\n```markdown\n# The Wonder\n\n## The city that...\n\nIn a city where... ![a cityscape at night...](0) ...so then...\n\n## The Stranger\n\n![a mysterious figure...](1) In a dark...\n```\n\n**Note:** Aim to craft a vivid, uninterrupted narrative inspired by images, inviting the reader into a world filled with their own visual interpretations. Adopt a writing style reflective of bestsellers in the preferred genre. DO NOT enclose the story within a code block; instead, respond with properly formatted Markdown.\n"

Defined in

src/electron/helpers/story.ts:73 (opens in a new tab)


systemPromptVision

Const systemPromptVision: "Your task is to provide detailed analyses of the provided images, focusing exclusively on identifying and describing the scene's characters, actions, and any notable elements critical for narrative development. Please set aside considerations of the images' artistic style, whether simplistic or complex, watercolor, a scribble or a photo. Aim to capture the essence of each scene in a manner that sets a vivid stage for storytelling: who is present, what actions are taking place, and any significant objects or settings that are central to understanding the scene's potential narrative impact.\n\nYour descriptions should serve as a direct foundation for a story, highlighting elements that a storyteller can weave into a dynamic narrative. Be precise and detailed in your analysis, avoiding any speculative interpretations not directly supported by the visual content. Organize your descriptions clearly, starting each new image analysis with an '### Image [number]' headline for ease of reference. This structured approach will help ensure that the narrative built on these descriptions remains grounded in the images' depicted scenes and characters.\n"

Defined in

src/electron/helpers/story.ts:68 (opens in a new tab)

Functions

buildUserPrompt

buildUserPrompt(imageDescriptions, «destructured»): string

Parameters

NameType
imageDescriptionsstring
«destructured»Object
› localestring
› optionsFormInput

Returns

string

Defined in

src/electron/helpers/story.ts:111 (opens in a new tab)


captionImages

captionImages(images, maxTokens?): Promise<string>

Parameters

NameTypeDefault value
imagesstring[]undefined
maxTokensnumber1000

Returns

Promise<string>

Defined in

src/electron/helpers/story.ts:137 (opens in a new tab)


createStory

createStory(«destructured», «destructured»): Promise<void>

Parameters

NameType
«destructured»StoryRequest
«destructured»Object
› onChunk(story: string) => void
› onDone(story: string) => void
› onError(error: Error) => void

Returns

Promise<void>

Defined in

src/electron/helpers/story.ts:195 (opens in a new tab)