Skip to content

Ahhhh2016/weekwise-trainingplan

Repository files navigation

WeekWise - AI้ฉฑๅŠจ็š„ๅ‘จ่ฎญ็ปƒ่ฎกๅˆ’ๅบ”็”จ

image

ไธ€ไธช็”ฑ AI ้ฉฑๅŠจ็š„ๅ‘จ่ฎญ็ปƒ่ฎกๅˆ’็”ŸๆˆไธŽๆ‰“ๅฐๅทฅๅ…ท๏ผŒ้€š่ฟ‡ๅฏน่ฏๅˆถๅฎšไธชๆ€งๅŒ–็š„ๆฏๅ‘จ่ฎญ็ปƒ่ฎกๅˆ’๏ผŒๆ”ฏๆŒ็ผ–่พ‘ๅ’Œๆ‰“ๅฐๅŠŸ่ƒฝ๏ผŒๅธฎๅŠฉไฝ ไฟๆŒ่Š‚ๅฅใ€ๅšๆŒ็›ฎๆ ‡ใ€‚

่ฎฟ้—ฎ็ฝ‘็ซ™๏ผšhttps://weekwise-trainingplan.vercel.app/

ๅŠŸ่ƒฝ็‰นๆ€ง

  • ๐Ÿค– AIๅฅ่บซๆ•™็ปƒๅŠฉๆ‰‹ - ไฝฟ็”จGitHub AI็”Ÿๆˆไธชๆ€งๅŒ–่ฎญ็ปƒ่ฎกๅˆ’
  • ๐Ÿ“… ๅ‘จ่ฎญ็ปƒ่ฎกๅˆ’ - 7ๅคฉๅฎŒๆ•ด็š„่ฎญ็ปƒๅฎ‰ๆŽ’
  • โœ๏ธ ๅฏ็ผ–่พ‘ๅ†…ๅฎน - ็‚นๅ‡ปๅณๅฏ็ผ–่พ‘่ฎญ็ปƒๅ†…ๅฎนใ€ๆ—ถ้•ฟๅ’Œๅค‡ๆณจ
  • โœ… ่ฟ›ๅบฆ่ทŸ่ธช - ๆฏๆ—ฅๅฎŒๆˆ็Šถๆ€ๆ ‡่ฎฐ
  • ๐Ÿ–จ๏ธ ๆ‰“ๅฐๅ‹ๅฅฝ - ไผ˜ๅŒ–็š„ๆ‰“ๅฐๆ ทๅผ๏ผŒๆ”ฏๆŒA4็บธๅผ 
  • ๐ŸŒ ไธญ่‹ฑๆ–‡ๅˆ‡ๆข - ไธ€้”ฎๅˆ‡ๆข็•Œ้ข่ฏญ่จ€๏ผŒๆ”ฏๆŒ English / ไธญๆ–‡

ๆŠ€ๆœฏๆ ˆ

ๅ‰็ซฏ

  • React 18 + TypeScript
  • Vite
  • Tailwind CSS
  • shadcn/ui ็ป„ไปถๅบ“
  • React Router

ๅŽ็ซฏ

  • Node.js + Express
  • GitHub AI API
  • CORSๆ”ฏๆŒ

ๅฟซ้€Ÿๅผ€ๅง‹

1. ๅฎ‰่ฃ…ไพ่ต–

npm install

2. ็Žฏๅขƒ้…็ฝฎ

็ผ–่พ‘ .env ๆ–‡ไปถ๏ผŒๆทปๅŠ ไฝ ็š„GitHub AI Token๏ผš

GITHUB_TOKEN=your_github_token_here
PORT=3001

3. ๅฏๅŠจๅผ€ๅ‘ๆœๅŠกๅ™จ

ๆ–นๅผไธ€๏ผšๅŒๆ—ถๅฏๅŠจๅ‰ๅŽ็ซฏ๏ผˆๆŽจ่๏ผ‰

npm run dev:full

ๆ–นๅผไบŒ๏ผšๅˆ†ๅˆซๅฏๅŠจ

# ็ปˆ็ซฏ1๏ผšๅฏๅŠจๅŽ็ซฏๆœๅŠกๅ™จ
npm run dev:server

# ็ปˆ็ซฏ2๏ผšๅฏๅŠจๅ‰็ซฏๅผ€ๅ‘ๆœๅŠกๅ™จ
npm run dev

4. ่ฎฟ้—ฎๅบ”็”จ

ไฝฟ็”จๆŒ‡ๅ—

็”Ÿๆˆ่ฎญ็ปƒ่ฎกๅˆ’

  1. ๆ่ฟฐไฝ ็š„ๅฅ่บซ็›ฎๆ ‡ใ€็ป้ชŒๆฐดๅนณใ€ๅฏ็”จๆ—ถ้—ด็ญ‰ไฟกๆฏ
  2. AIไผš็”Ÿๆˆไธชๆ€งๅŒ–็š„ๅ‘จ่ฎญ็ปƒ่ฎกๅˆ’
  3. ็”ŸๆˆๅŽ็‚นๅ‡ปโ€œๆ‰“ๅฐๅ‘จ่ฎญ็ปƒ่ฎกๅˆ’โ€œๆŒ‰้’ฎ๏ผŒ่ทณ่ฝฌๅˆฐๆ–ฐ็š„้กต้ข

็ผ–่พ‘่ฎญ็ปƒ่ฎกๅˆ’

  • ็‚นๅ‡ปไปปๆ„่ฎญ็ปƒๅ†…ๅฎนใ€ๆ—ถ้•ฟๆˆ–ๅค‡ๆณจๅŒบๅŸŸ่ฟ›่กŒ็ผ–่พ‘
  • ็‚นๅ‡ปๆ ‡้ข˜ๅฏไปฅไฟฎๆ”น่ฎญ็ปƒ่ฎกๅˆ’ๅ็งฐ
  • ไฝฟ็”จๅค้€‰ๆก†ๆ ‡่ฎฐๆฏๆ—ฅๅฎŒๆˆ็Šถๆ€

ๆ‰“ๅฐ่ฎญ็ปƒ่ฎกๅˆ’

  • ็‚นๅ‡ปๅณไธŠ่ง’็š„๐Ÿ–จ๏ธๆŒ‰้’ฎๆˆ–ไฝฟ็”จๅฟซๆท้”ฎ Ctrl+P
  • ้กต้ขๅทฒไผ˜ๅŒ–ไธบA4็บธๅผ ๆ‰“ๅฐๆ ผๅผ

API็ซฏ็‚น

่ŠๅคฉAPI

POST /api/chat
Content-Type: application/json

{
  "message": "็”จๆˆทๆถˆๆฏ",
  "history": [่Šๅคฉๅކๅฒ]
}

็”Ÿๆˆ่ฎญ็ปƒ่ฎกๅˆ’API

POST /api/generate-plan
Content-Type: application/json

{
  "prompt": "่ฎญ็ปƒ่ฎกๅˆ’ๆ่ฟฐ"
}

ๅฅๅบทๆฃ€ๆŸฅAPI

GET /api/health

้กน็›ฎ็ป“ๆž„

weekwise/
โ”œโ”€โ”€ src/                    # ๅ‰็ซฏๆบไปฃ็ 
โ”‚   โ”œโ”€โ”€ components/         # React็ป„ไปถ
โ”‚   โ”œโ”€โ”€ pages/             # ้กต้ข็ป„ไปถ
โ”‚   โ”œโ”€โ”€ lib/               # ๅทฅๅ…ทๅบ“ๅ’ŒAPIๆœๅŠก
โ”‚   โ””โ”€โ”€ hooks/             # ่‡ชๅฎšไน‰Hooks
โ”œโ”€โ”€ server/                # ๅŽ็ซฏๆœๅŠกๅ™จ
โ”‚   โ””โ”€โ”€ index.js           # ExpressๆœๅŠกๅ™จ
โ”œโ”€โ”€ public/                # ้™ๆ€่ต„ๆบ
โ””โ”€โ”€ dist/                  # ๆž„ๅปบ่พ“ๅ‡บ

ๅผ€ๅ‘่ฏดๆ˜Ž

ๆทปๅŠ ๆ–ฐ็š„API็ซฏ็‚น

  1. ๅœจ server/index.js ไธญๆทปๅŠ ๆ–ฐ็š„่ทฏ็”ฑ
  2. ๅœจ src/lib/api.ts ไธญๆทปๅŠ ๅฏนๅบ”็š„APIๆœๅŠกๆ–นๆณ•
  3. ๅœจๅ‰็ซฏ็ป„ไปถไธญ่ฐƒ็”จAPIๆœๅŠก

่‡ชๅฎšไน‰่ฎญ็ปƒ่ฎกๅˆ’ๆ ผๅผ

ไฟฎๆ”น server/index.js ไธญ็š„ TRAINING_PLAN_PROMPT ๆฅ่ฐƒๆ•ดAI็”Ÿๆˆ็š„ๅ†…ๅฎนๆ ผๅผใ€‚

้ƒจ็ฝฒ

ๆž„ๅปบ็”Ÿไบง็‰ˆๆœฌ

npm run build

ๅฏๅŠจ็”ŸไบงๆœๅŠกๅ™จ

npm run dev:server

ๆ•…้šœๆŽ’้™ค

ๅธธ่ง้—ฎ้ข˜

  1. AIๅŠŸ่ƒฝไธๅทฅไฝœ

    • ๆฃ€ๆŸฅ .env ๆ–‡ไปถไธญ็š„ GITHUB_TOKEN ๆ˜ฏๅฆๆญฃ็กฎ่ฎพ็ฝฎ
    • ็กฎ่ฎค็ฝ‘็ปœ่ฟžๆŽฅๆญฃๅธธ
  2. ๅ‰็ซฏๆ— ๆณ•่ฟžๆŽฅๅŽ็ซฏ

    • ็กฎ่ฎคๅŽ็ซฏๆœๅŠกๅ™จๅœจ3001็ซฏๅฃ่ฟ่กŒ
    • ๆฃ€ๆŸฅViteไปฃ็†้…็ฝฎ
  3. ๆ‰“ๅฐๆ ทๅผ้—ฎ้ข˜

    • ไฝฟ็”จChromeๆˆ–Edgeๆต่งˆๅ™จ
    • ็กฎไฟๅฏ็”จไบ†ๆ‰“ๅฐ่ƒŒๆ™ฏ้ขœ่‰ฒ้€‰้กน

่ดก็Œฎ

ๆฌข่ฟŽๆไบคIssueๅ’ŒPull Requestๆฅๆ”น่ฟ›่ฟ™ไธช้กน็›ฎ๏ผ

่ฎธๅฏ่ฏ

MIT License

ๅพ…ๅผ€ๅ‘ๅŠŸ่ƒฝ

  • ็งปๅŠจ็ซฏ้€‚้…
  • ่‹ฑๆ–‡่ฎญ็ปƒ่ฎกๅˆ’็”Ÿๆˆ

WeekWise - AI-Powered Weekly Training Plan App

An AI-powered tool for generating and printing personalized weekly training plans. Through natural conversation, you can design a tailored weekly workout schedule, edit it, and print it โ€” helping you stay consistent and reach your fitness goals.

Visit the website: https://weekwise-trainingplan.vercel.app/

Features

  • ๐Ÿค– AI Fitness Coach โ€“ Uses GitHub AI to generate personalized training plans
  • ๐Ÿ“… Weekly Training Schedule โ€“ A complete 7-day workout routine with training tips and key strategies
  • โœ๏ธ Editable Content โ€“ Click to modify exercises, duration, and notes
  • โœ… Progress Tracking โ€“ Mark your daily completion status
  • ๐Ÿ–จ๏ธ Print-Friendly Design โ€“ Optimized layout for A4 printing
  • ๐ŸŒ Bilingual Interface โ€“ One-click switch between English / ไธญๆ–‡

Tech Stack

Frontend

  • React 18 + TypeScript
  • Vite
  • Tailwind CSS
  • shadcn/ui component library
  • React Router

Backend

  • Node.js + Express
  • GitHub AI API
  • CORS support

Getting Started

1. Install dependencies

npm install

2. Environment setup

Edit the .env file and add your GitHub AI Token:

GITHUB_TOKEN=your_github_token_here
PORT=3001

3. Start the development servers

Option 1: Start both frontend and backend together (recommended)

npm run dev:full

Option 2: Start them separately

# Terminal 1: Start the backend server
npm run dev:server

# Terminal 2: Start the frontend dev server
npm run dev

4. Access the app

Frontend: http://localhost:8080

Backend API: http://localhost:3001

Health check: http://localhost:3001/api/health

User Guide

Generate a training plan

  1. Describe your fitness goals, experience level, and available time.
  2. The AI will generate a personalized weekly plan.
  3. After generation, click the โ€œPrint Weekly Planโ€ button to open the printable view.

Edit your training plan

  • Click any exercise, duration, or note to edit it directly.
  • Click the title to rename the plan.
  • Use checkboxes to mark daily completion.

Print your training plan

  • Click the ๐Ÿ–จ๏ธ button at the top right or press Ctrl+P.
  • The page is optimized for A4 paper printing.

API Endpoints

Chat API

POST /api/chat
Content-Type: application/json

{
  "message": "็”จๆˆทๆถˆๆฏ",
  "history": [่Šๅคฉๅކๅฒ]
}

Generate Training Plan API

POST /api/generate-plan
Content-Type: application/json

{
  "prompt": "่ฎญ็ปƒ่ฎกๅˆ’ๆ่ฟฐ"
}

Health Check

GET /api/health

Project Structure

weekwise/
โ”œโ”€โ”€ src/                    # Frontend source code
โ”‚   โ”œโ”€โ”€ components/         # React components
โ”‚   โ”œโ”€โ”€ pages/              # Page components
โ”‚   โ”œโ”€โ”€ lib/                # Utilities and API services
โ”‚   โ””โ”€โ”€ hooks/              # Custom React hooks
โ”œโ”€โ”€ server/                 # Backend server
โ”‚   โ””โ”€โ”€ index.js            # Express server entry point
โ”œโ”€โ”€ public/                 # Static assets
โ””โ”€โ”€ dist/                   # Build output

Development Guide

Adding a new API endpoint

  1. Add a new route in server/index.js
  2. Add the corresponding API function in src/lib/api.ts
  3. Call the API function from your frontend component

Customizing the training plan format

Modify the TRAINING_PLAN_PROMPT in server/index.js to adjust how the AI structures the generated content.

Deployment

Build for production

npm run build

Start the production server

npm run dev:server

Troubleshooting

Common Issues

  1. AI features not working
  • Check whether your GITHUB_TOKEN in .env is correctly set
  • Ensure your network connection is stable
  1. Frontend cannot connect to backend
  • Make sure the backend server is running on port 3001
  • Check your Vite proxy configuration
  1. Printing layout issues
  • Use Chrome or Edge browsers
  • Make sure โ€œPrint Background Colorsโ€ is enabled

Contributing

Contributions are welcome! Please submit Issues or Pull Requests to help improve this project.

License

MIT License

Features To Be Implemented

  • Mobile adaptation
  • English-based training plan generation

About

An AI-powered training companion that chats with you, designs personalized weekly plans, and lets you print them to stay on track.

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors