"use client"; import { createNotesApiClient } from "@/lib/api-helpers"; export type CopilotAction = "shorten" | "expand" | "bulletize" | "grammar" | "fix-rewrite" | "change-tone" | "continue" | "explain"; export type CopilotTone = "formal" | "casual" | "professional" | "friendly"; export async function copilotTransform( noteId: string, workspaceId: string, action: CopilotAction, text: string, tone?: CopilotTone, ): Promise { const api = createNotesApiClient(); const res = await api.fetch<{ text: string }>(`/notes/${encodeURIComponent(noteId)}/copilot`, { method: "POST", body: JSON.stringify({ workspaceId, action, text, ...(tone ? { tone } : {}) }), }); return res.text; } export async function suggestNoteTitle(noteId: string, workspaceId: string): Promise { const api = createNotesApiClient(); const res = await api.fetch<{ title: string }>(`/notes/${encodeURIComponent(noteId)}/suggest-title`, { method: "POST", body: JSON.stringify({ workspaceId }), }); return res.title; }