Skip to content

Refactor prompt construction to avoid duplicate metadata and ambiguous formatting #11

Description

@LostOne1000

Priority

Medium

Summary

When current metadata is enabled, the existing title and caption are inserted into both the user prompt and system prompt.

The user-prompt version also concatenates values without clear section boundaries.

Relevant code

prompt =
    useCurrentData
        and "Title: "
            .. currentData.title
            .. " Caption: "
            .. currentData.caption
            .. prompt
        or prompt

Current metadata is then repeated in the system prompt.

Problems

  • Existing metadata is duplicated in the model context.
  • Prompt size is unnecessarily increased.
  • The boundary between the caption and user instruction can be ambiguous.
  • Conflicting copies make prompt behavior harder to reason about and test.

Expected behavior

Current metadata should be represented once in a clearly structured section.

Proposed structure

Current metadata

Title:
Crosswind

Caption:
A model walking through downtown Iowa City.

User request:
Improve the caption while preserving the original concept.

Implementation notes

Create a dedicated prompt-construction function.

The function should accept:

  • User prompt
  • Current title
  • Current caption
  • Whether current metadata should be included
  • Whether the standard system prompt should be used

Keep system instructions separate from current photo metadata where practical.

Acceptance criteria

  • Current title and caption are included no more than once.
  • Metadata fields and user instructions have explicit separators.
  • Empty title or caption values are handled cleanly.
  • Disabling current metadata excludes it completely.
  • Disabling the standard system prompt continues to produce a valid request.
  • Prompt construction is isolated in a testable function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions