mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
- Add Task Assistant nav entry (Sparkles icon) to sidebar between Kanban and Projects - Create lib/api/prompter.ts with createSession, sendMessage, getDraft API functions - Create hooks/use-prompter.ts with 6-state machine (empty→chatting→draft_preview→review_modal→launching→success) - Create ChatMessages with auto-scroll, user/assistant/error rendering, inline DraftProposalCard - Create ChatComposer with Enter-to-send and Shift+Enter for newline - Create DraftProposalCard with title, description, acceptance criteria, metadata badges, Keep Chatting/Review & Confirm actions - Create ConfirmDialog (Radix Dialog, no form element) with MarkdownEditor, AcceptanceCriteriaEditor, metadata selects, warning banner, disabled Confirm & Launch until valid - Create SuccessCard with task title, team, View Task link, Start Another button - Create /prompter route page composing all components via usePrompter hook - TypeScript and ESLint pass with zero errors Co-authored-by: Frontend Developer 2 <fe-dev-2@agents.roboco.dev>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import api from "./client";
|
|
import type { Team, TaskType, Complexity } from "@/types";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Types
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export interface DraftProposal {
|
|
title: string;
|
|
description: string;
|
|
acceptance_criteria: string[];
|
|
team: Team;
|
|
priority?: number;
|
|
task_type?: TaskType;
|
|
estimated_complexity?: Complexity;
|
|
}
|
|
|
|
export interface ChatResponse {
|
|
reply: string;
|
|
draft?: DraftProposal | null;
|
|
session_id: string;
|
|
}
|
|
|
|
export interface CreateSessionResponse {
|
|
session_id: string;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// API functions
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export const prompterApi = {
|
|
/**
|
|
* Create a new prompter session, returning a session ID.
|
|
*/
|
|
createSession: async (): Promise<CreateSessionResponse> => {
|
|
const { data } = await api.post<CreateSessionResponse>("/prompter/sessions");
|
|
return data;
|
|
},
|
|
|
|
/**
|
|
* Send a chat message in an existing session.
|
|
* Returns the assistant reply and, if ready, a draft task proposal.
|
|
*/
|
|
sendMessage: async (
|
|
sessionId: string,
|
|
message: string
|
|
): Promise<ChatResponse> => {
|
|
const { data } = await api.post<ChatResponse>(
|
|
`/prompter/sessions/${sessionId}/chat`,
|
|
{ message }
|
|
);
|
|
return data;
|
|
},
|
|
|
|
/**
|
|
* Fetch the current draft for a session (if the LLM has produced one).
|
|
*/
|
|
getDraft: async (sessionId: string): Promise<DraftProposal | null> => {
|
|
const { data } = await api.get<{ draft: DraftProposal | null }>(
|
|
`/prompter/sessions/${sessionId}/draft`
|
|
);
|
|
return data.draft;
|
|
},
|
|
};
|