import type { UIMessage } from "ai"; export type ChatMessageFeedbackVote = "up" | "down"; /** Ask AI answer feedback, as sent to the central feedback service. */ export interface ChatMessageFeedback { /** The assistant answer, as Markdown. */ answer: string; /** * Root-relative, app-public path of the page the reader was on when * voting, including `basePath`. */ pageUrl: string; /** The reader's question that the answer responds to. */ question: string; /** URLs of the sources shown for the answer. */ sources: string[]; vote: ChatMessageFeedbackVote; } /** Longest question or answer text sent with Ask AI feedback. */ export declare const CHAT_FEEDBACK_TEXT_LIMIT = 4000; /** Most source URLs sent with Ask AI feedback. */ export declare const CHAT_FEEDBACK_SOURCE_LIMIT = 10; /** The feedback service rejects `url` values over 1,024 characters. */ export declare const CHAT_FEEDBACK_URL_LIMIT = 1024; /** The feedback service rejects `note` values over 16,384 characters. */ export declare const CHAT_FEEDBACK_NOTE_LIMIT = 16384; /** First line of every Ask AI feedback note, for feedback triage. */ export declare const CHAT_FEEDBACK_NOTE_PREFIX = "[Ask AI]"; export declare const CHAT_FEEDBACK_EMOJI: Record; /** * Shorten `value` to at most `limit` characters, ending with an ellipsis * when shortened. Never splits a surrogate pair. */ export declare const capText: (value: string, limit: number) => string; export declare const isChatMessageFeedbackVote: (value: unknown) => value is ChatMessageFeedbackVote; /** The vote stored on a message by `withMessageFeedbackVote`, if any. */ export declare const readMessageFeedbackVote: (message: Pick) => ChatMessageFeedbackVote | undefined; /** * Record `vote` in the metadata of the message with `messageId`, keeping * every other metadata key (such as the eve stream position) so the vote * persists with stored chat history without changing later chat requests. */ export declare const withMessageFeedbackVote: (messages: Message[], messageId: string, vote: ChatMessageFeedbackVote) => Message[]; /** * Validate and cap feedback before it crosses a trust boundary. Server * actions accept arbitrary input, so the server re-runs this on whatever the * browser sent. Returns `null` for input that is not answer feedback. */ export declare const normalizeChatMessageFeedback: (input: unknown) => ChatMessageFeedback | null; /** * Collect feedback for the assistant message with `messageId`. Returns * `null` when the message is missing, is not an assistant message, or has no * text to rate. */ export declare const buildChatMessageFeedback: ({ messageId, messages, pageUrl, vote, }: { messageId: string; messages: UIMessage[]; pageUrl: string; vote: ChatMessageFeedbackVote; }) => ChatMessageFeedback | null; /** * The `note` sent to the feedback service. Its first line starts with * `CHAT_FEEDBACK_NOTE_PREFIX` and the vote emoji, so triage can tell Ask AI * feedback from page feedback, then summarizes the question on one line * because the service titles the issue with the note's first words. The * answer comes last so the note limit can only ever shorten the answer. */ export declare const formatChatMessageFeedbackNote: (feedback: ChatMessageFeedback) => string; //# sourceMappingURL=message-feedback.d.ts.map