forked from Rockachopa/Timmy-time-dashboard
Add /api/chat, /api/upload, and /api/chat/history endpoints to the FastAPI dashboard so the Expo mobile app talks directly to Timmy's brain (Ollama) instead of a non-existent Node.js server. Backend: - New src/dashboard/routes/chat_api.py with 4 endpoints - Mount /uploads/ for serving chat attachments - Same context injection and session management as HTMX chat Mobile app fixes: - Point API base URL at port 8000 (FastAPI) instead of 3000 - Create lib/_core/theme.ts (was referenced but never created) - Fix shared/types.ts (remove broken drizzle/errors re-exports) - Remove broken server/chat.ts and 1,235-line template README - Clean package.json (remove express, mysql2, drizzle, tRPC deps) - Remove debug console.log from theme-provider Tests: 13 new tests covering all API endpoints (all passing). https://claude.ai/code/session_01XqErDoh2rVsPY8oTj21Lz2 Co-authored-by: Claude <noreply@anthropic.com>
32 lines
989 B
TypeScript
32 lines
989 B
TypeScript
/**
|
|
* Shared type definitions for the Timmy Chat mobile app.
|
|
*/
|
|
|
|
// ── Chat Message Types ──────────────────────────────────────────────────────
|
|
|
|
export type MessageRole = "user" | "assistant";
|
|
|
|
export type MessageContentType = "text" | "image" | "file" | "voice";
|
|
|
|
export interface ChatMessage {
|
|
id: string;
|
|
role: MessageRole;
|
|
contentType: MessageContentType;
|
|
text?: string;
|
|
/** URI for image, file, or voice attachment */
|
|
uri?: string;
|
|
/** Original filename for files */
|
|
fileName?: string;
|
|
/** File size in bytes */
|
|
fileSize?: number;
|
|
/** MIME type for attachments */
|
|
mimeType?: string;
|
|
/** Duration in seconds for voice messages */
|
|
duration?: number;
|
|
/** Remote URL after upload (for images/files/voice sent to server) */
|
|
remoteUrl?: string;
|
|
timestamp: number;
|
|
/** Whether the message is still being generated */
|
|
pending?: boolean;
|
|
}
|