How 874wokiite/ai-secretary-zundamon works
Project Type and Purpose
• This is a Chrome extension built using Plasmo framework with React, TypeScript, and Tailwind CSS. Its purpose is to provide an AI-assisted secretary experience where "ずんだもん" supports users by reminding them of daily schedules (by integrating with Google Calendar), engaging in chat using OpenAI’s GPT-4o, and providing motivational “toast” messages.
• The README emphasizes three main features: schedule reminders, chat interactions, and supportive or motivational messages.
File Structure
• The top-level files include configuration files like .eslintrc.json, .prettierrc, package.json, tsconfig.json, and tailwind.config.js which set up the project’s coding style and build process.
• Assets and documents folders supply static resources such as images and sounds (including specialized assets for ずんだもん).
• The src directory is organized into clear subdirectories:
• “background”: Contains the background scripts and message handling logic (e.g., getMessage.ts, setPhraseReminder.ts, etc.) which interface with Plasmo’s messaging system.
• “components”: Contains reusable UI components like Button, IconButton, Popup, and the specific ZundamonImage component.
• “features”: Divided into feature-specific folders (Chat, Remainder, Title) that encapsulate components, hooks, and types for each main function.
• “contents”: Likely represents the popup or the primary UI content.
• “hooks”, “styles”, “types” and “utils” provide shared utilities across the project.
Key Architectural Components
a. Chrome Extension Shell:
• Content UI/Popup: Represented by “src/contents” and “src/components” that render the user interface.
• Background Scripts: Located in “src/background” with messaging logic to handle API calls and scheduled reminder setups.
• Messaging System: Utilizing Plasmo’s @plasmohq/messaging to bridge messages between the Content Scripts and Background Scripts (to circumnavigate CORS issues).
b. Feature Modules:
• Chat Feature: Managed in “src/features/Chat” where chat components, hooks (useGetMessage.tsx), and types define the chatting experience with GPT-4o.
• Reminder Feature: Handled in “src/features/Remainder”, with its own UI components and hooks (for fetching phrases, schedules, summary, and setting reminders). This module interfaces with Google Calendar API for scheduling.
• Title/Entrance Feature: In “src/features/Title” to welcome users and transition them into the experience.
c. External Integrations:
• OpenAI GPT-4o: For AI text generation used in both the chat and the reminder features.
• Google Calendar API: For fetching calendar events and schedules, integrated within the background or custom hooks.
• External Dependencies: Include utility libraries (e.g., react-spring for animations) as mentioned in the README.