fix(mobile): align PromptCategory with backend, add tone param, remove dead import

- note-prompts.ts: fix PromptCategory ('analysis' → 'analyze', remove nonexistent 'vision'/'custom')
- note-prompts.ts: add CopilotTone type and optional tone param to copilotTransform
- capture.tsx: remove unused copilotTransform import (copilot requires real noteId)
This commit is contained in:
saravanakumardb1 2026-04-06 10:47:38 -07:00
parent b424b490be
commit 0aad04f91a
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import { getApiClient } from './client';
export type PromptCategory = 'transform' | 'extract' | 'generate' | 'analysis' | 'vision' | 'export' | 'custom';
export type PromptCategory = 'transform' | 'extract' | 'generate' | 'analyze' | 'export';
export type PromptInputType = 'text' | 'image' | 'text+image' | 'multi-note';
export type PromptOutputType = 'new_note' | 'artifact' | 'update_note';
@ -70,15 +70,18 @@ export async function extractFromUrl(
});
}
export type CopilotTone = 'formal' | 'casual' | 'professional' | 'friendly';
export async function copilotTransform(
noteId: string,
workspaceId: string,
action: string,
text: string,
tone?: CopilotTone,
): Promise<string> {
const res = await getApiClient().fetch<{ text: string }>(
`/notes/${encodeURIComponent(noteId)}/copilot`,
{ method: 'POST', body: JSON.stringify({ workspaceId, action, text }) },
{ method: 'POST', body: JSON.stringify({ workspaceId, action, text, ...(tone ? { tone } : {}) }) },
);
return res.text;
}

View File

@ -4,7 +4,7 @@ import * as Clipboard from 'expo-clipboard';
import type { MobileWorkspace } from '../../api/workspaces';
import { useNotesStore, type NotesState } from '../../store/notes-store';
import { useWorkspaceStore, type WorkspaceState } from '../../store/workspace-store';
import { extractFromUrl, copilotTransform } from '../../api/note-prompts';
import { extractFromUrl } from '../../api/note-prompts';
import { colors } from '../../theme';
type CaptureMode = 'text' | 'photo' | 'voice' | 'url' | 'scan' | 'paste';