Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For everyone who finds city services "用不了" (*"I can't use it"*), so they c

For people with disabilities, older adults, pregnant people, people with low vision and carers, the problem is rarely that a service does not exist. It is that they cannot use it: too many entry points, long forms, small text, and screens that have to be read carefully.

The **Care Assistant** lives inside the Town Pass app (Taipei's city app). People describe what they need in one sentence or tap a suggestion. The assistant looks up Taipei open data to find the nearest accessible toilets or parking with disabled spaces. When something needs to be done, it opens the right Town Pass service with the details it already knows (water account number, phone, email) filled in, asks the person to confirm before leaving, and never submits anything on their behalf. The language model runs on the phone, so conversations are not sent to a cloud model.
The **Care Assistant** lives inside the Town Pass app (Taipei's city app). People describe what they need in one sentence, by voice or by typing, or tap a suggestion. The assistant looks up Taipei open data to find the nearest accessible toilets or parking with disabled spaces. When something needs to be done, it opens the right Town Pass service with the details it already knows (water account number, phone, email) filled in, asks the person to confirm before leaving, and never submits anything on their behalf. The language model runs on the phone, so conversations are not sent to a cloud model.

## Screenshots

Expand All @@ -34,10 +34,11 @@ The **Care Assistant** lives inside the Town Pass app (Taipei's city app). Peopl

- **Accessibility first**: built to WCAG 2.1 AA. Fixes TalkBack not being able to swipe into WebView content; text follows the system font size and reflows at 200% without horizontal scrolling; the system bold text, high contrast and reduce motion settings are mirrored into the page.
- **Multi-sensory feedback**: haptics when an answer arrives, a lookup fails, an emergency card appears or a choice is tapped. With voice feedback on (and no screen reader running), answers are read aloud automatically. Read-aloud uses the system voice, or the optional on-device BlueMagpie natural voice.
- **Find places**: accessible toilets, parking with disabled or pregnancy priority spaces, and live YouBike availability, near the current location or in a chosen district; every lookup shows its data source and time.
- **Get things done**: Town Pass services such as bill payment, city reports, police reports and counter queue numbers. Leaving the assistant always asks for confirmation; known fields are filled in, and a city report is drafted from the person's own words as an editable draft that never adds details they did not say.
- **Emergency help**: emergencies skip the model and show call buttons for 119, 110, 113 and 1925 straight away.
- **On-device AI**: the LFM3-VL-2B multimodal language model runs on Android as a native child process, with optional whisper.cpp speech recognition and BlueMagpie speech synthesis. All three listen on loopback only, and no model ships with the app.
- **Voice input**: a voice button on the home screen and a microphone next to the input box. Inside the app, speech is recognised on the phone and the recording stays in memory; in a plain browser, the browser's own speech recognition is used. The recognised text goes into the input box first, and the person decides when to send it.
- **Find places**: accessible toilets, parking with disabled or pregnancy priority spaces, and live YouBike availability, near the current location (GPS), in a chosen district or around a well-known landmark; every lookup shows its data source and time.
- **Get things done**: Town Pass services such as bill payment, city reports, disaster reports, police reports and counter queue numbers. Leaving the assistant always asks for confirmation; known fields are filled in, and any field that cannot be filled in is listed so the person can fill it in themselves. City reports and disaster reports are drafted from the person's own words as editable drafts that never add details they did not say.
- **Emergency help**: when the rules detect an emergency, the assistant skips the model and shows call buttons for 119, 110, 113 and 1925 straight away; the router also has an emergency option for cases the rules miss. The buttons stay after a reload, and read-aloud explains how to call.
- **On-device AI**: the LFM3-VL-2B multimodal language model runs on Android as a native child process, with optional whisper.cpp speech recognition (for voice input) and BlueMagpie speech synthesis. All three listen on loopback only, and no model ships with the app.
- **Privacy**: location is only used to compute distances and never sent to the model; national ID numbers are read from the member profile each time, shown masked, and never stored.

## Architecture
Expand All @@ -52,7 +53,7 @@ flowchart LR
end
end
WebView --> Agent["Care Assistant (Vue 3)<br/>routing, skills, tool validation, accessibility layer"]
Agent -- "read-aloud, haptics, accessibility state, open service, member data" --> Bridge
Agent -- "read-aloud, haptics, accessibility state, voice input, open service, member data" --> Bridge
Bridge -- "MethodChannel" --> Native
Agent -- "loopback HTTP + Bearer key" --> Native
Agent --> Tools["tools/townpass<br/>read-only tools and data layer"]
Expand All @@ -62,11 +63,11 @@ flowchart LR

| Part | What it does | Where |
| --- | --- | --- |
| App | Town Pass Flutter app, `TPWebView`, JS bridge (read-aloud, haptics, accessibility state, form prefill), TalkBack and system font size fixes | `lib/`, `android/` |
| Care Assistant | Vue 3 web app: routing and skills, tap-to-answer choices, city report drafts, emergency calls, accessibility layer | `frontend/agent-mvp/` |
| Tools | Wraps Town Pass services and open data as read-only tools, with timeouts, caching and validation in the data layer | `tools/townpass/` |
| App | Town Pass Flutter app, `TPWebView`, JS bridge (read-aloud, haptics, accessibility state, voice input, form prefill), TalkBack and system font size fixes | `lib/`, `android/` |
| Care Assistant | Vue 3 web app: routing and skills, tap-to-answer choices, city and disaster report drafts, emergency calls, voice input, accessibility layer | `frontend/agent-mvp/` |
| Tools | Wraps Town Pass services and open data as read-only tools, with timeouts, caching and validation in the data layer; also a shared service tool registry, still in development, where a model on the host turns web pages or API documents into tools step by step | `tools/townpass/` |
| On-device AI | Build and model tooling for LFM3-VL-2B (llama.cpp), whisper.cpp ASR and BlueMagpie TTS | `tools/llm-android/`, `tools/asr-android/`, `tools/tts-android/` |
| Service template | Snapshot of TownPass-Services, kept for reference | `frontend/` |
| Service template | Snapshot of TownPass-Services (for reference), plus the `/about` data sources page and an in-page text size control | `frontend/` |

## Tech stack

Expand Down Expand Up @@ -124,11 +125,11 @@ CI only checks the parts affected by a change; see [CONTRIBUTING.md](CONTRIBUTIN
lib/ Flutter app (Town Pass snapshot, assistant entry, bridges)
android/ Android native code (on-device AI services, TalkBack fix)
frontend/agent-mvp/ Care Assistant web app
tools/townpass/ Read-only tools and data layer
tools/townpass/ Read-only tools, data layer and shared service tool registry
tools/llm-android/ Build and install tooling for on-device LFM3
tools/asr-android/ Build and model conversion tooling for whisper.cpp ASR
tools/tts-android/ Build and model tooling for BlueMagpie TTS
frontend/ TownPass-Services template (reference)
frontend/ TownPass-Services template and the /about data sources page
docs/screenshots/ README screenshots
```

Expand All @@ -141,6 +142,8 @@ By default the app only answers from the real data and official services below,
| YouBike 2.0 Taipei real-time availability | Department of Transportation, Taipei City Government | <https://data.taipei/dataset/detail?id=c6bc8aed-557d-41d5-bfb1-8da24f78f2fb> | Bikes and docks available at nearby stations (updated every minute) |
| Taipei parking lots | Parking Management and Development Office, Department of Transportation | <https://data.taipei/dataset/detail?id=d5c0656b-5250-4179-a491-c94daa56ef2c> | Location, fees, disabled and pregnancy priority spaces (live free-space data is discontinued and not used) |
| Taipei public toilets | Department of Environmental Protection, Taipei City Government | <https://data.taipei/dataset/detail?id=ca205b54-a06f-4d84-894c-d6ab5079ce79> | Accessible stalls, family stalls and changing beds (bundled official dated snapshot) |
| Taipei petition system categories | Research, Development and Evaluation Commission, Taipei City Government | <https://data.taipei/dataset/detail?id=cb423c17-88eb-4231-a725-f1b93247d1bf> | Petition categories, subcategories and the agencies that handle them |
| Taipei monthly report of area, districts, villages and neighbourhoods | Department of Civil Affairs, Taipei City Government | <https://data.taipei/dataset/detail?id=d1bb140b-733b-43cc-91ca-685a984d022a> | Names of Taipei's 12 districts |

Open data is attributed under the [Open Government Data License, version 1.0](https://data.gov.tw/license); every lookup shows the provider, dataset and data time.

Expand All @@ -164,7 +167,7 @@ This project is licensed under the [GNU Affero General Public License v3.0](LICE
## Acknowledgements

- The **Department of Information Technology, Taipei City Government**, for open-sourcing [Town Pass](https://github.com/taipei-doit/TownPass) and [TownPass-Services](https://github.com/taipei-doit/TownPass-Services) and providing the [Town Pass developer guide](https://tpe-guideline.web.app) and design resources.
- **Open data providers**: the Department of Transportation, its Parking Management and Development Office, the Department of Environmental Protection, and the [Taipei Open Data platform](https://data.taipei).
- **Open data providers**: the Department of Transportation, its Parking Management and Development Office, the Department of Environmental Protection, the Research, Development and Evaluation Commission, the Department of Civil Affairs, and the [Taipei Open Data platform](https://data.taipei).
- **Open models and projects**: [Liquid AI](https://huggingface.co/LiquidAI) (LFM3), [OpenFormosa](https://huggingface.co/OpenFormosa) (BlueMagpie-TTS), [adi-gov-tw](https://huggingface.co/adi-gov-tw) (Taiwan-Tongues-ASR-CE), [ggml-org](https://github.com/ggml-org) (llama.cpp, whisper.cpp, ggml), [codec.cpp](https://github.com/mybigday/codec.cpp), and the Flutter, Vue, Vite, Playwright and axe-core communities.

### Contributors
Expand Down
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

身心障礙者、長者、孕婦、視力不便者與照顧者常遇到的不是「沒有服務」,而是「用不了」:入口太多、表單太長、字太小、要看清楚畫面才能操作。

**安心助手**是嵌在城市通 App 裡的助理。使用者用一句話描述需求或點選建議,助手會查詢臺北市的開放資料、找出最近的無障礙廁所或身障車位;需要辦事時,帶著已知的資料(水號、手機、Email)開啟台北通站內服務,由使用者確認後才前往,不代為送出。語言模型在手機上本機執行,對話不送到雲端模型。
**安心助手**是嵌在城市通 App 裡的助理。使用者用說的或打字描述需求,或點選建議,助手會查詢臺北市的開放資料、找出最近的無障礙廁所或身障車位;需要辦事時,帶著已知的資料(水號、手機、Email)開啟台北通站內服務,由使用者確認後才前往,不代為送出。語言模型在手機上本機執行,對話不送到雲端模型。

## 截圖

Expand All @@ -34,10 +34,11 @@

- **無障礙優先**:以 WCAG 2.1 AA 為標準。修正 TalkBack 無法滑進 WebView 內容的問題;字級跟隨系統並可放大到 200% 而不需橫向捲動;系統的粗體、高對比與減少動態設定會同步到網頁。
- **多感官回饋**:回答完成、出錯、緊急狀況與點選選項時有震動;「語音回饋」打開時(且沒有開螢幕閱讀器),回答會自動朗讀。朗讀使用系統語音,也可選用手機本機的 BlueMagpie 自然語音。
- **找地點**:依目前位置或行政區,查無障礙廁所、身障與孕婦優先車位、YouBike 即時車輛;每次查詢都標示資料來源與時間。
- **帶你去辦事**:繳費、陳情、報案、臨櫃叫號等台北通站內服務。前往前一律再確認一次;已知欄位自動帶入,陳情內容依使用者原話整理成可修改的草稿,不編造沒說過的內容。
- **緊急求助**:偵測到緊急狀況時不經模型,直接顯示 119、110、113、1925 的撥號按鈕。
- **本機 AI**:在 Android 上以 native 子行程執行 LFM3-VL-2B 多模態語言模型,另有選用的 whisper.cpp 語音辨識與 BlueMagpie 語音合成;三者都只綁 loopback,模型不隨 App 發布。
- **語音輸入**:首頁的語音鍵與輸入框旁的麥克風。App 內用手機本機語音辨識,錄音只留在記憶體;純瀏覽器時改用瀏覽器內建的語音辨識。辨識出的文字先填入輸入框,由使用者確認後才送出。
- **找地點**:依目前位置(GPS)、行政區或常見地標,查無障礙廁所、身障與孕婦優先車位、YouBike 即時車輛;每次查詢都標示資料來源與時間。
- **帶你去辦事**:繳費、陳情、災情通報、報案、臨櫃叫號等台北通站內服務。前往前一律再確認一次;已知欄位自動帶入,帶不進去的欄位會列出來請使用者自己填;陳情與災情通報依使用者原話整理成可修改的草稿,不編造沒說過的內容。
- **緊急求助**:規則偵測到緊急狀況時不經模型,直接顯示 119、110、113、1925 的撥號按鈕;規則沒抓到的,路由另有「緊急」選項兜底。重新載入後按鈕仍在,朗讀也會說明撥號方式。
- **本機 AI**:在 Android 上以 native 子行程執行 LFM3-VL-2B 多模態語言模型,另有選用的 whisper.cpp 語音辨識(語音輸入用)與 BlueMagpie 語音合成;三者都只綁 loopback,模型不隨 App 發布。
- **隱私**:位置只用來計算距離、不送進模型;身分證字號每次從會員資料讀取、只遮罩顯示,不寫入儲存空間。

## 架構
Expand All @@ -52,7 +53,7 @@ flowchart LR
end
end
WebView --> Agent["安心助手(Vue 3)<br/>路由、skill、工具驗證、無障礙層"]
Agent -- "朗讀、震動、無障礙狀態、開啟服務、會員資料" --> Bridge
Agent -- "朗讀、震動、無障礙狀態、語音輸入、開啟服務、會員資料" --> Bridge
Bridge -- "MethodChannel" --> Native
Agent -- "loopback HTTP + Bearer key" --> Native
Agent --> Tools["tools/townpass<br/>唯讀工具與資料讀取層"]
Expand All @@ -62,11 +63,11 @@ flowchart LR

| 區塊 | 內容 | 位置 |
| --- | --- | --- |
| App | Town Pass Flutter app、`TPWebView`、JS bridge(朗讀、震動、無障礙狀態、表單帶入)、TalkBack 與系統字級修正 | `lib/`、`android/` |
| 安心助手 | Vue 3 Web App:路由與各 skill、補資料的選擇題、陳情草稿、緊急撥號、無障礙層 | `frontend/agent-mvp/` |
| 工具 | 把台北通服務與開放資料包裝成唯讀工具,經資料讀取層處理逾時、快取與格式驗證 | `tools/townpass/` |
| App | Town Pass Flutter app、`TPWebView`、JS bridge(朗讀、震動、無障礙狀態、語音輸入、表單帶入)、TalkBack 與系統字級修正 | `lib/`、`android/` |
| 安心助手 | Vue 3 Web App:路由與各 skill、補資料的選擇題、陳情與災情通報草稿、緊急撥號、語音輸入、無障礙層 | `frontend/agent-mvp/` |
| 工具 | 把台北通服務與開放資料包裝成唯讀工具,經資料讀取層處理逾時、快取與格式驗證;另有開發中的共用服務工具庫,由主機上的模型把頁面或 API 文件逐步解析成工具 | `tools/townpass/` |
| 本機 AI | LFM3-VL-2B(llama.cpp)、whisper.cpp ASR、BlueMagpie TTS 的建置與模型工具 | `tools/llm-android/`、`tools/asr-android/`、`tools/tts-android/` |
| 服務範本 | TownPass-Services 快照,保留作參考 | `frontend/` |
| 服務範本 | TownPass-Services 快照(參考用),另加上 `/about` 資料來源頁與頁內字級切換 | `frontend/` |

## 技術棧

Expand Down Expand Up @@ -124,11 +125,11 @@ CI 會依改動的路徑只檢查受影響的部分,見 [CONTRIBUTING.md](CONT
lib/ Flutter app(Town Pass 快照、安心助手入口、bridge)
android/ Android 原生碼(本機 AI 服務、TalkBack 修正)
frontend/agent-mvp/ 安心助手 Web App
tools/townpass/ 唯讀工具與資料讀取層
tools/townpass/ 唯讀工具、資料讀取層與共用服務工具庫
tools/llm-android/ LFM3 本機推論的建置與安裝工具
tools/asr-android/ whisper.cpp 語音辨識的建置與模型轉換工具
tools/tts-android/ BlueMagpie 語音合成的建置與模型工具
frontend/ TownPass-Services 服務範本(參考用)
frontend/ TownPass-Services 服務範本與 /about 資料來源頁
docs/screenshots/ README 截圖
```

Expand All @@ -141,6 +142,8 @@ App 預設只用下列真實資料與官方服務,不拿模擬資料回答使
| YouBike2.0臺北市公共自行車即時資訊 | 臺北市政府交通局 | <https://data.taipei/dataset/detail?id=c6bc8aed-557d-41d5-bfb1-8da24f78f2fb> | 附近站點的即時可借、可還數(每分鐘更新) |
| 臺北市停車場資訊 | 臺北市政府交通局停車管理工程處 | <https://data.taipei/dataset/detail?id=d5c0656b-5250-4179-a491-c94daa56ef2c> | 停車場位置、費率、身障與孕婦車位數(剩餘車位已停更,不使用) |
| 臺北市公廁點位資訊 | 臺北市政府環境保護局 | <https://data.taipei/dataset/detail?id=ca205b54-a06f-4d84-894c-d6ab5079ce79> | 無障礙廁座、親子廁座、照護床(打包官方日期快照) |
| 臺北市陳情系統類別資料 | 臺北市政府研究發展考核委員會 | <https://data.taipei/dataset/detail?id=cb423c17-88eb-4231-a725-f1b93247d1bf> | 陳情的主類別、次類別與受理機關 |
| 臺北市所轄面積暨行政區里鄰數量月報表 | 臺北市政府民政局 | <https://data.taipei/dataset/detail?id=d1bb140b-733b-43cc-91ca-685a984d022a> | 臺北市 12 個行政區的名稱 |

開放資料依[《政府資料開放授權條款-第1版》](https://data.gov.tw/license)顯名,畫面上每次查詢都標示提供機關、資料集與資料時間。

Expand All @@ -164,7 +167,7 @@ App 預設只用下列真實資料與官方服務,不拿模擬資料回答使
## 致謝

- **臺北市政府資訊局**開源 [Town Pass](https://github.com/taipei-doit/TownPass) 與 [TownPass-Services](https://github.com/taipei-doit/TownPass-Services),並提供[城市通開發文件](https://tpe-guideline.web.app)與設計資源。
- **開放資料提供機關**:臺北市政府交通局、交通局停車管理工程處、環境保護局,以及[臺北市資料大平臺](https://data.taipei)。
- **開放資料提供機關**:臺北市政府交通局、交通局停車管理工程處、環境保護局、研究發展考核委員會、民政局,以及[臺北市資料大平臺](https://data.taipei)。
- **開源模型與專案**:[Liquid AI](https://huggingface.co/LiquidAI)(LFM3)、[OpenFormosa](https://huggingface.co/OpenFormosa)(BlueMagpie-TTS)、[adi-gov-tw](https://huggingface.co/adi-gov-tw)(Taiwan-Tongues-ASR-CE)、[ggml-org](https://github.com/ggml-org)(llama.cpp、whisper.cpp、ggml)、[codec.cpp](https://github.com/mybigday/codec.cpp),以及 Flutter、Vue、Vite、Playwright、axe-core 等社群。

### 貢獻者
Expand Down
Loading