Set up the basic structure and core functionality for the application
Initialize project with UI components, core libraries, and basic app structure. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 556aa286-edd2-4cea-8583-f4fc3cfd119b
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
import { apiRequest } from "@/lib/queryClient";
|
||||
|
||||
export interface JokeResponse {
|
||||
joke: string;
|
||||
category?: string;
|
||||
cached: boolean;
|
||||
processingTime?: number;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface ChatResponse {
|
||||
response: string;
|
||||
processingTime: number;
|
||||
modelUsed: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface InsightResponse {
|
||||
insight: string;
|
||||
type: string;
|
||||
processingTime: number;
|
||||
modelUsed: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface AIStatus {
|
||||
loaded: boolean;
|
||||
modelPath: string;
|
||||
initialized: boolean;
|
||||
uptime: number;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export const aiService = {
|
||||
async getDailyJoke(): Promise<JokeResponse> {
|
||||
const response = await apiRequest("GET", "/api/ai/daily-joke");
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async generateJoke(personalized: boolean = false): Promise<JokeResponse> {
|
||||
const url = personalized ? "/api/ai/generate-joke?personalized=true" : "/api/ai/generate-joke";
|
||||
const response = await apiRequest("POST", url);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async chat(message: string): Promise<ChatResponse> {
|
||||
const response = await apiRequest("POST", "/api/ai/chat", { message });
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async generateInsight(type: "financial" | "productivity" | "general"): Promise<InsightResponse> {
|
||||
const response = await apiRequest("POST", "/api/ai/generate-insight", { type });
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getInteractions(type?: string, limit?: number): Promise<{ interactions: any[] }> {
|
||||
const params = new URLSearchParams();
|
||||
if (type) params.append("type", type);
|
||||
if (limit) params.append("limit", limit.toString());
|
||||
|
||||
const url = `/api/ai/interactions${params.toString() ? `?${params.toString()}` : ""}`;
|
||||
const response = await apiRequest("GET", url);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getStatus(): Promise<AIStatus> {
|
||||
const response = await apiRequest("GET", "/api/ai/status");
|
||||
return response.json();
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
import { apiRequest } from "@/lib/queryClient";
|
||||
|
||||
export interface LoginRequest {
|
||||
email: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface RegisterRequest {
|
||||
username: string;
|
||||
email: string;
|
||||
password: string;
|
||||
confirmPassword: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
role?: string;
|
||||
}
|
||||
|
||||
export interface AuthResponse {
|
||||
message: string;
|
||||
user: any;
|
||||
}
|
||||
|
||||
export const authService = {
|
||||
async login(email: string, password: string): Promise<AuthResponse> {
|
||||
const response = await apiRequest("POST", "/api/auth/login", { email, password });
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async register(userData: RegisterRequest): Promise<AuthResponse> {
|
||||
const response = await apiRequest("POST", "/api/auth/register", userData);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async logout(): Promise<void> {
|
||||
await apiRequest("POST", "/api/auth/logout");
|
||||
},
|
||||
|
||||
async getCurrentUser(): Promise<any> {
|
||||
const response = await apiRequest("GET", "/api/auth/me");
|
||||
const data = await response.json();
|
||||
return data.user;
|
||||
},
|
||||
|
||||
async updateProfile(updates: any): Promise<AuthResponse> {
|
||||
const response = await apiRequest("PUT", "/api/auth/profile", updates);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async completeOnboarding(role: string, preferences?: any): Promise<AuthResponse> {
|
||||
const response = await apiRequest("POST", "/api/auth/complete-onboarding", {
|
||||
role,
|
||||
preferences,
|
||||
});
|
||||
return response.json();
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
import { apiRequest } from "@/lib/queryClient";
|
||||
import { FinancialRecord, InsertFinancialRecord } from "@shared/schema";
|
||||
|
||||
export interface FinancialRecordsResponse {
|
||||
records: FinancialRecord[];
|
||||
}
|
||||
|
||||
export interface FinancialRecordResponse {
|
||||
record: FinancialRecord;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface FinancialSummaryResponse {
|
||||
summary: {
|
||||
income: number;
|
||||
expenses: number;
|
||||
net: number;
|
||||
};
|
||||
period: string;
|
||||
startDate?: string;
|
||||
endDate?: string;
|
||||
}
|
||||
|
||||
export const financialService = {
|
||||
async getRecords(startDate?: string, endDate?: string): Promise<FinancialRecordsResponse> {
|
||||
const params = new URLSearchParams();
|
||||
if (startDate) params.append("startDate", startDate);
|
||||
if (endDate) params.append("endDate", endDate);
|
||||
|
||||
const url = `/api/financial/records${params.toString() ? `?${params.toString()}` : ""}`;
|
||||
const response = await apiRequest("GET", url);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getSummary(period?: "week" | "month" | "year", startDate?: string, endDate?: string): Promise<FinancialSummaryResponse> {
|
||||
const params = new URLSearchParams();
|
||||
if (period) params.append("period", period);
|
||||
if (startDate) params.append("startDate", startDate);
|
||||
if (endDate) params.append("endDate", endDate);
|
||||
|
||||
const url = `/api/financial/summary${params.toString() ? `?${params.toString()}` : ""}`;
|
||||
const response = await apiRequest("GET", url);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async createRecord(record: InsertFinancialRecord & { createdViaVoice?: boolean; voiceTranscription?: string; metadata?: any }): Promise<FinancialRecordResponse> {
|
||||
const response = await apiRequest("POST", "/api/financial/records", record);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async updateRecord(id: number, updates: Partial<FinancialRecord>): Promise<FinancialRecordResponse> {
|
||||
const response = await apiRequest("PUT", `/api/financial/records/${id}`, updates);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async deleteRecord(id: number): Promise<{ message: string }> {
|
||||
const response = await apiRequest("DELETE", `/api/financial/records/${id}`);
|
||||
return response.json();
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
import { apiRequest } from "@/lib/queryClient";
|
||||
import { Task, InsertTask } from "@shared/schema";
|
||||
|
||||
export interface TasksResponse {
|
||||
tasks: Task[];
|
||||
}
|
||||
|
||||
export interface TaskResponse {
|
||||
task: Task;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export const taskService = {
|
||||
async getTasks(status?: string): Promise<TasksResponse> {
|
||||
const url = status ? `/api/tasks?status=${status}` : "/api/tasks";
|
||||
const response = await apiRequest("GET", url);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getTask(id: number): Promise<TaskResponse> {
|
||||
const response = await apiRequest("GET", `/api/tasks/${id}`);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async createTask(task: InsertTask & { createdViaVoice?: boolean; voiceTranscription?: string }): Promise<TaskResponse> {
|
||||
const response = await apiRequest("POST", "/api/tasks", task);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async updateTask(id: number, updates: Partial<Task>): Promise<TaskResponse> {
|
||||
const response = await apiRequest("PUT", `/api/tasks/${id}`, updates);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async deleteTask(id: number): Promise<{ message: string }> {
|
||||
const response = await apiRequest("DELETE", `/api/tasks/${id}`);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async completeTask(id: number): Promise<TaskResponse> {
|
||||
return this.updateTask(id, { status: "completed", completedAt: new Date() });
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
import { apiRequest } from "@/lib/queryClient";
|
||||
|
||||
export interface VoiceCommandResult {
|
||||
transcription: string;
|
||||
intent?: string;
|
||||
confidence: number;
|
||||
processingTime: number;
|
||||
actionResult?: any;
|
||||
}
|
||||
|
||||
export interface VoiceStatus {
|
||||
stt: boolean;
|
||||
tts: boolean;
|
||||
initialized: boolean;
|
||||
uptime: number;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export const voiceService = {
|
||||
async initialize(): Promise<{ message: string; status: string }> {
|
||||
const response = await apiRequest("POST", "/api/voice/initialize");
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async processCommand(audioData: string): Promise<VoiceCommandResult> {
|
||||
const response = await apiRequest("POST", "/api/voice/process-command", {
|
||||
audioData,
|
||||
});
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async speak(text: string, voice?: string): Promise<Blob> {
|
||||
const response = await apiRequest("POST", "/api/voice/speak", {
|
||||
text,
|
||||
voice,
|
||||
});
|
||||
return response.blob();
|
||||
},
|
||||
|
||||
async getCommands(limit?: number): Promise<{ commands: any[] }> {
|
||||
const url = limit ? `/api/voice/commands?limit=${limit}` : "/api/voice/commands";
|
||||
const response = await apiRequest("GET", url);
|
||||
return response.json();
|
||||
},
|
||||
|
||||
async getStatus(): Promise<VoiceStatus> {
|
||||
const response = await apiRequest("GET", "/api/voice/status");
|
||||
return response.json();
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user