Skip to content

/api/ai history entries are unvalidated #11

Description

@royalpinto007

Problem

/api/ai maps history entries blindly (m.role, m.content); [null] throws and {role: "user"} forwards the literal string "undefined" upstream. Only prompt is validated.

Where

app/api/ai/route.ts (history mapping).

Acceptance

Add a failing test first POSTing {prompt: "hi?", history: [null]} asserting 400 with a structured error. Then fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions