Skip to content

Commit e9878bf

Browse files
committed
refactor: rename telegram_qa to telegram_assistant
1 parent 2f0b0d9 commit e9878bf

6 files changed

Lines changed: 18 additions & 18 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
4848
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
4949
GEMINI_MODEL: ${{ vars.GEMINI_MODEL }}
50-
run: python src/telegram_qa.py
50+
run: python src/telegram_assistant.py

docs/README.en.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ This is a GitHub Actions-driven automation project for tracking and filtering Ji
5353
- Keyword filtering with built-in defaults and optional `KEYWORDS_FILE`
5454
- Gemini grading and summary logic: `src/gemini.py`
5555
- Telegram push messaging: `src/tg01.py`
56-
- Telegram Q&A listener: `src/telegram_qa.py`
56+
- Telegram Q&A listener: `src/telegram_assistant.py`
5757
- Shared recent-news context: `data/recent_news.json`
5858
- Scheduled execution via GitHub Actions every 6 hours
5959

@@ -74,10 +74,10 @@ Telegram push
7474
7575
Save to data/recent_news.json
7676
77-
telegram_qa.py answers questions using recent context
77+
telegram_assistant.py answers questions using recent context
7878
```
7979

80-
`jin10_monitor.py` and `telegram_qa.py` run as separate processes and share the same `recent_news.json` file for context.
80+
`jin10_monitor.py` and `telegram_assistant.py` run as separate processes and share the same `recent_news.json` file for context.
8181

8282
---
8383

@@ -116,7 +116,7 @@ python src/jin10_monitor.py
116116
### 5. Run the Telegram Q&A bot (optional)
117117

118118
```bash
119-
python src/telegram_qa.py
119+
python src/telegram_assistant.py
120120
```
121121

122122
In a Telegram group, you can mention the bot or use `/ask`; in private chat, you can send a question directly.
@@ -130,7 +130,7 @@ This project includes two workflows:
130130
| Workflow | Purpose |
131131
|---|---|
132132
| `flash_monitor.yml` | Runs `src/jin10_monitor.py` on a schedule and pushes filtered news |
133-
| `telegram_qa.yml` | Runs `src/telegram_qa.py` to answer Telegram questions |
133+
| `telegram_assistant.yml` | Runs `src/telegram_assistant.py` to answer Telegram questions |
134134

135135
Set these in GitHub `Settings → Secrets and variables → Actions`:
136136

docs/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
- 關鍵字過濾:支援內建關鍵字清單,也可用 `KEYWORDS_FILE` 自訂
5454
- Gemini 分級與摘要:`src/gemini.py`
5555
- Telegram 推播:`src/tg01.py`
56-
- Telegram 對話問答:`src/telegram_qa.py`
56+
- Telegram 對話問答:`src/telegram_assistant.py`
5757
- 共享近期新聞上下文:`data/recent_news.json`
5858
- GitHub Actions 自動執行:每 6 小時排程一次,支援手動觸發
5959

@@ -74,10 +74,10 @@ Telegram 推播
7474
7575
寫入 data/recent_news.json
7676
77-
telegram_qa.py 依背景資料回答 Telegram 問題
77+
telegram_assistant.py 依背景資料回答 Telegram 問題
7878
```
7979

80-
`jin10_monitor.py``telegram_qa.py` 是兩個獨立流程,共同使用 `recent_news.json` 作為近期快訊上下文。
80+
`jin10_monitor.py``telegram_assistant.py` 是兩個獨立流程,共同使用 `recent_news.json` 作為近期快訊上下文。
8181

8282
---
8383

@@ -116,7 +116,7 @@ python src/jin10_monitor.py
116116
### 5. 啟動 Telegram 問答腳本(可選)
117117

118118
```bash
119-
python src/telegram_qa.py
119+
python src/telegram_assistant.py
120120
```
121121

122122
在群組中可直接 @ 機器人或使用 `/ask`;私人聊天則可直接輸入問題。
@@ -130,7 +130,7 @@ python src/telegram_qa.py
130130
| Workflow | 作用 |
131131
|---|---|
132132
| `flash_monitor.yml` | 執行 `src/jin10_monitor.py`,監控快訊並推播 |
133-
| `telegram_qa.yml` | 執行 `src/telegram_qa.py`,接收 Telegram 問題並回答 |
133+
| `telegram_assistant.yml` | 執行 `src/telegram_assistant.py`,接收 Telegram 問題並回答 |
134134

135135
在 GitHub 的 `Settings → Secrets and variables → Actions` 中新增:
136136

src/jin10_monitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ async def summarize_with_gemini(session: aiohttp.ClientSession, text: str) -> Op
316316
}
317317

318318

319-
# ─── Recent flash context (for telegram_qa.py Q&A) ───────────────────────────
319+
# ─── Recent flash context (for telegram_assistant.py Q&A) ───────────────────────────
320320

321321
recent_news: deque[dict] = deque(maxlen=CONTEXT_MAX_ITEMS)
322322

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ def extract_question(text: str, bot_username: str, chat_type: str) -> Optional[s
9090

9191
# ─── Main loop ─────────────────────────────────────────────────────────────────
9292

93-
async def telegram_qa_loop(session: aiohttp.ClientSession) -> None:
93+
async def telegram_assistant_loop(session: aiohttp.ClientSession) -> None:
9494
bot_username = await get_bot_username(session)
9595
if bot_username:
96-
log.info("Telegram Q&A listener started. Bot username: @%s", bot_username)
96+
log.info("Telegram Assistant listener started. Bot username: @%s", bot_username)
9797
else:
98-
log.info("Telegram Q&A listener started (bot username not available; in groups, use the /ask command)")
98+
log.info("Telegram Assistant listener started (bot username not available; in groups, use the /ask command)")
9999

100100
url = f"{TELEGRAM_API}/getUpdates"
101101
offset: Optional[int] = None
@@ -150,7 +150,7 @@ async def main() -> None:
150150
log.warning("GEMINI_API_KEY is not set; Q&A will always return a failure message")
151151

152152
async with aiohttp.ClientSession() as session:
153-
await telegram_qa_loop(session)
153+
await telegram_assistant_loop(session)
154154

155155

156156
if __name__ == "__main__":

src/test_telegram_listener.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN", "")
1414
GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY", "")
15-
GITHUB_WORKFLOW_FILE = os.getenv("GITHUB_WORKFLOW_FILE", "telegram_qa.yml")
15+
GITHUB_WORKFLOW_FILE = os.getenv("GITHUB_WORKFLOW_FILE", "telegram_assistant.yml")
1616

1717

1818
async def check_webhook(session: aiohttp.ClientSession) -> None:
@@ -59,7 +59,7 @@ async def check_polling_conflict(session: aiohttp.ClientSession) -> None:
5959
if resp.status == 409:
6060
print(f"❌ 409 Conflict: {body.get('description', '')}")
6161
print(" Another process is currently polling getUpdates.")
62-
print(" Check: local telegram_qa.py instance or running GitHub Actions job.")
62+
print(" Check: local telegram_assistant.py instance or running GitHub Actions job.")
6363
elif resp.status == 200:
6464
print("✅ No conflict detected at this moment.")
6565
print("Note: This is a point-in-time check; run multiple times for intermittent issues.")

0 commit comments

Comments
 (0)