1export default async function(req: Request): Promise<Response> {
2return new Response(null, {
3status: 301,
untitled-341index.ts1 match
1export default async function(req: Request) {
2const html = `<!DOCTYPE html>
3<html lang="en">
1516// Initialize Slack client
17function getSlackClient(): WebClient | null {
18const slackToken = Deno.env.get("SLACK_BOT_TOKEN");
19if (!slackToken) {
2526// Main handler for HTTP requests
27export default async function(req: Request): Promise<Response> {
28try {
29// Handle Slack URL verification challenge
82* Process a message from Slack and check if it's a bug report
83*/
84async function processSlackMessage(event: any): Promise<void> {
85// Skip messages in threads (we only want to process new messages)
86if (event.thread_ts && event.thread_ts !== event.ts) {
127* Use LLM to detect if a message is a bug report
128*/
129async function isBugReportLLM(text: string): Promise<boolean> {
130try {
131// Check if OpenAI API key is available
144Analyze the following message and determine if it's reporting a bug, technical issue, or problem. Consider:
145- Technical problems (crashes, errors, performance issues)
146- User experience issues (confusing UI, broken functionality)
147- Data problems (incorrect results, missing information)
148- Regression issues (something that used to work)
149- User complaints about functionality not working as expected
150151DO NOT classify as bug reports:
179* Detect if a message is a bug report using LLM
180*/
181async function isBugReport(text: string | undefined): Promise<boolean> {
182if (!text) {
183return false;
190* Fetch all open issues from GitHub repository using Octokit
191*/
192async function fetchOpenIssues(): Promise<any[]> {
193const githubToken = Deno.env.get("GITHUB_TOKEN");
194const githubRepo = Deno.env.get("GITHUB_REPO");
247* Use LLM to find semantically related issues
248*/
249async function findRelatedIssues(slackMessage: string, issues: any[]): Promise<any[]> {
250try {
251// Check if OpenAI API key is available
357* Format the related issues into final Slack message
358*/
359function formatRelatedIssues(issueMatches: any[]): string {
360if (issueMatches.length === 0) {
361return "No related open issues found. This might be a new issue that hasn't been reported yet.";
378* Post a message to a Slack thread
379*/
380async function postToSlackThread(channel: string, thread_ts: string, text: string): Promise<void> {
381const webClient = getSlackClient();
382if (!webClient) {
reactHonoStarterApp.tsx1 match
12};
1314export function App() {
15const [clicked, setClicked] = useState(0);
16return (
9}
1011export default function TravelPlanner({ onNotification, refreshTrigger, onRefresh }: TravelPlannerProps) {
12const [destinations, setDestinations] = useState([]);
13const [loading, setLoading] = useState(true);
9}
1011export default function GoalTracker({ onNotification, refreshTrigger, onRefresh }: GoalTrackerProps) {
12const [goals, setGoals] = useState([]);
13const [showForm, setShowForm] = useState(false);
9}
1011export default function ExpenseForm({ onNotification, refreshTrigger, onRefresh }: ExpenseFormProps) {
12const [formData, setFormData] = useState({
13amount: '',
9}
1011export default function Dashboard({ onNotification, refreshTrigger, onRefresh }: DashboardProps) {
12const [loading, setLoading] = useState(true);
13const [data, setData] = useState<any>({
Smart_Expense_TrackerApp.tsx3 matches
17}
1819export default function App() {
20const [activeTab, setActiveTab] = useState<Tab>('dashboard');
21const [notifications, setNotifications] = useState<Notification[]>([]);
22const [refreshTrigger, setRefreshTrigger] = useState(0);
2324// Function to trigger data refresh across components
25const triggerRefresh = () => {
26setRefreshTrigger(prev => prev + 1);
27};
2829// Function to show notifications
30const showNotification = (notification: Omit<Notification, 'id'>) => {
31const id = Date.now().toString();
Smart_Expense_Trackerqueries.ts15 matches
45// User queries
6export async function getUser(userId: number = 1): Promise<User | null> {
7const result = await sqlite.execute("SELECT * FROM users_v1 WHERE id = ?", [userId]);
8if (result.length === 0) return null;
18}
1920export async function updateUser(userId: number, updates: Partial<User>): Promise<void> {
21const fields = [];
22const values = [];
4546// Expense queries
47export async function addExpense(expense: Omit<Expense, 'id' | 'createdAt'>): Promise<number> {
48const result = await sqlite.execute(`
49INSERT INTO expenses_v1 (user_id, amount, category, description, date)
54}
5556export async function getExpenses(userId: number = 1, limit: number = 50): Promise<Expense[]> {
57const result = await sqlite.execute(`
58SELECT * FROM expenses_v1
73}
7475export async function getExpensesByMonth(userId: number = 1, month: string = getMonthYear()): Promise<Expense[]> {
76const result = await sqlite.execute(`
77SELECT * FROM expenses_v1
91}
9293export async function deleteExpense(expenseId: number, userId: number = 1): Promise<void> {
94await sqlite.execute("DELETE FROM expenses_v1 WHERE id = ? AND user_id = ?", [expenseId, userId]);
95}
9697// Goal queries
98export async function addGoal(goal: Omit<Goal, 'id' | 'createdAt' | 'isCompleted'>): Promise<number> {
99const result = await sqlite.execute(`
100INSERT INTO goals_v1 (user_id, title, description, target_amount, current_amount, target_date, category, image_url)
105}
106107export async function getGoals(userId: number = 1): Promise<Goal[]> {
108const result = await sqlite.execute(`
109SELECT * FROM goals_v1
127}
128129export async function updateGoalProgress(goalId: number, amount: number, userId: number = 1): Promise<void> {
130await sqlite.execute(`
131UPDATE goals_v1
136}
137138export async function deleteGoal(goalId: number, userId: number = 1): Promise<void> {
139await sqlite.execute("DELETE FROM goals_v1 WHERE id = ? AND user_id = ?", [goalId, userId]);
140}
141142// Budget queries
143export async function setBudget(userId: number, category: string, monthlyLimit: number, month: string = getMonthYear()): Promise<void> {
144await sqlite.execute(`
145INSERT OR REPLACE INTO budgets_v1 (user_id, category, monthly_limit, month)
148}
149150export async function getBudgets(userId: number = 1, month: string = getMonthYear()): Promise<Budget[]> {
151const result = await sqlite.execute(`
152SELECT b.*, COALESCE(SUM(e.amount), 0) as current_spent
170171// Travel destinations
172export async function getTravelDestinations(): Promise<TravelDestination[]> {
173const result = await sqlite.execute("SELECT * FROM travel_destinations_v1 ORDER BY name");
174
189190// Analytics queries
191export async function getMonthlyReport(userId: number = 1, month: string = getMonthYear()): Promise<MonthlyReport> {
192const user = await getUser(userId);
193const expenses = await getExpensesByMonth(userId, month);
222}
223224export async function getCategorySpending(userId: number = 1, months: number = 6): Promise<Record<string, number[]>> {
225const result = await sqlite.execute(`
226SELECT