# 專案部屬 (Discord Bot) ## 前置作業 ### Gemini API (https://aistudio.google.com) 1. 取得資料集 [[傳送門](https://aistudio.google.com/app/prompts?state=%7B%22ids%22:%5B%221TKrEiB-I--zQiqxA8Sv8Yq52v0x1uDzJ%22%5D,%22action%22:%22open%22,%22userId%22:%22116774267197029822933%22,%22resourceKeys%22:%7B%7D%7D&usp=sharing)] 2. Tune a model - 選擇資料集 - 設定參數 - Epochs: 25 - Batch size: 15 - Learning rate: 0.001 - 記下 `Model ID` (可先測試是否正常)  3. 申請 OAuth 驗證 - https://ai.google.dev/gemini-api/docs/oauth?hl=zh-tw 4. 取得 `client_secret.json` 檔案 5. 取得 `Google AI Studio API key` ### 其他 API - [TDX 運輸資料流通服務](https://tdx.transportdata.tw/) - `Client Id` - `Client Secret` - [氣象資料開放平臺](https://opendata.cwa.gov.tw/) - 取得 `授權碼` ### 設定步驟 - https://github.com/xiaojie4082/PU_Discord_Bot 1. 在專案目錄中建立 `.env` 檔案。 2. 在 `.env` 檔案中填入以下資料: ```env DISCORD_TOKEN = <Discord Bot Token> TDX_ID = <Client Id> TDX_KEY = <Client Secret> CWA_KEY = <授權碼> GOOGLE_API_KEY = <Google AI Studio API key> ``` 3. 在專案目錄下運行以下指令以安裝所需的依賴: - 建議使用虛擬環境 ```sh pip install -r requirements.txt ``` 4. 將 `client_secret.json` 憑證放入 `/api` 目錄內。 5. 運行 `main.py` 以及 `api/gs_api.py` 來啟動機器人。 ### 其他注意事項 > 每學期選課時須修改 `cmds/course.py` 的學期,學年度+(上學期為 1 下學期為二),如 114 上學期則為 1141。 > ```python > @option("學期", > description="選擇要搜尋的學期", > choices=["1131", "1132"], > required=True > ) > ``` > `api/token.json` 是自動生成的檔案會過期,請定時刪除並重新執行 `api/gs_api.py`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up