Remove cloud backend — on-device Tensor chip only

Delete GeminiCloudModel.kt entirely. All inference now runs through
Gemini Nano on the Tensor G5 TPU via ML Kit, with MediaPipe as fallback
for custom local model files. No data leaves the device.

- OnDeviceModel.create() reverts to Nano → MediaPipe chain, no apiKey param
- Removed: API key UI, SharedPreferences key storage, cloud model routing
- Removed: thinking mode (cloud-only feature)
- Removed: pixel10-fast / pixel10-thinking model IDs → single "pixel10" model
- /v1/models now reports honest on-device limits (4096 ctx, 1024 output)
- CI smoke test updated: installs APK on emulator and verifies package,
  no inference tests (require real Pixel hardware with Tensor chip)

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
alexpolo1
2026-02-28 21:58:21 +01:00
co-authored by Claude Sonnet 4.6
parent ac24db518f
commit ec3beea01e
9 changed files with 76 additions and 728 deletions
+15 -79
View File
@@ -38,15 +38,23 @@ jobs:
name: app-debug
path: app/build/outputs/apk/debug/app-debug.apk
test:
name: API Integration Tests
# NOTE: Full inference tests (tool calling, generation) require a real Pixel
# device with the Tensor chip and Gemini Nano available via AICore.
# The emulator has no Tensor chip — run on-device tests manually with:
# adb install app-debug.apk
# adb shell am startservice -n com.pixel10.ai/.server.ApiServerService \
# -a com.pixel10.ai.START_SERVER --ei port 8080
# adb forward tcp:8080 tcp:8080
# curl http://localhost:8080/health
install-smoke:
name: Install + Smoke Test (emulator)
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Enable KVM (hardware-accelerated emulator)
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \
| sudo tee /etc/udev/rules.d/99-kvm4all.rules
@@ -59,15 +67,6 @@ jobs:
java-version: "17"
distribution: "temurin"
- name: Cache Gradle
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-
- name: Download APK artifact
uses: actions/download-artifact@v4
with:
@@ -110,71 +109,8 @@ jobs:
- name: Install APK
run: $ANDROID_HOME/platform-tools/adb install apk/app-debug.apk
- name: Write Gemini API key to SharedPreferences
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
- name: Verify APK installed
run: |
$ANDROID_HOME/platform-tools/adb shell run-as com.pixel10.ai sh -c \
'mkdir -p /data/data/com.pixel10.ai/shared_prefs && cat > /data/data/com.pixel10.ai/shared_prefs/pixel10_prefs.xml' << EOF
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<map>
<string name="gemini_api_key">${GEMINI_API_KEY}</string>
</map>
EOF
- name: Start API server
run: |
$ANDROID_HOME/platform-tools/adb shell am startservice \
-n com.pixel10.ai/.server.ApiServerService \
-a com.pixel10.ai.START_SERVER \
--ei port 8080
sleep 5
- name: Forward device port
run: $ANDROID_HOME/platform-tools/adb forward tcp:8080 tcp:8080
- name: Wait for server to be ready
run: |
timeout 30 bash -c '
until curl -sf http://localhost:8080/health > /dev/null 2>&1; do
sleep 2
done
'
- name: Test /health
run: |
RESPONSE=$(curl -sf http://localhost:8080/health)
echo "Health response: $RESPONSE"
echo "$RESPONSE" | grep -q '"status"' || \
(echo "FAIL: /health did not return expected JSON" && exit 1)
- name: Test /v1/models
run: |
RESPONSE=$(curl -sf http://localhost:8080/v1/models)
echo "Models response: $RESPONSE"
echo "$RESPONSE" | grep -q '"data"' || \
(echo "FAIL: /v1/models did not return expected JSON" && exit 1)
- name: Test /v1/chat/completions (non-streaming)
run: |
RESPONSE=$(curl -sf http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gemini","messages":[{"role":"user","content":"Reply with one word: hello"}]}')
echo "Chat response: $RESPONSE"
echo "$RESPONSE" | grep -q '"choices"' || \
(echo "FAIL: /v1/chat/completions did not return choices" && exit 1)
- name: Test /v1/chat/completions (streaming)
run: |
# Collect SSE chunks with a 20-second timeout
CHUNKS=$(curl -sf --max-time 20 http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gemini","stream":true,"messages":[{"role":"user","content":"Say hi"}]}')
echo "Streaming chunks received:"
echo "$CHUNKS"
echo "$CHUNKS" | grep -q "data:" || \
(echo "FAIL: streaming returned no SSE chunks" && exit 1)
- name: Print logcat on failure
if: failure()
run: $ANDROID_HOME/platform-tools/adb logcat -d -s Pixel10AI ApiServerService GeminiCloudModel
$ANDROID_HOME/platform-tools/adb shell pm list packages | grep com.pixel10.ai \
|| (echo "FAIL: APK not installed" && exit 1)
echo "PASS: APK installed successfully"