Skip to content

ModelRelay Integration & Desktop Logic Refactor#5

Merged
gitricko merged 6 commits into
mainfrom
modelrelay
Apr 18, 2026
Merged

ModelRelay Integration & Desktop Logic Refactor#5
gitricko merged 6 commits into
mainfrom
modelrelay

Conversation

@gitricko

Copy link
Copy Markdown
Owner

Pull Request: ModelRelay Integration & Desktop Logic Refactor

🦞 Overview

This PR improves the maintainability of the WebTop environment by refactoring shared shell logic and fully integrating ModelRelay as a pre-configured, intelligent API proxy. It automates the configuration of ModelRelay within PicoClaw and generalizes desktop shortcut management.

🚀 Key Changes

1. 🛠️ Infrastructure & Shared Logic

  • docker/common.sh (New): Centralized the sync_desktop_file logic into a reusable shell script. This provides a robust way for all startup scripts to deploy desktop icons and autostart entries with:
    • Automatic parent directory creation.
    • Proper abc:abc ownership.
    • Content-change detection (only updates files if they've changed).
  • Refactored Startup Scripts: Updated start-picoclaw.sh and start-modelrelay.sh to source the shared utility, significantly cleaning up the codebase.

2. 🔄 ModelRelay Deep Integration

  • Zero-Touch Configuration: Added automated logic to start-modelrelay.sh that detects and injects the modelrelay API endpoint (http://localhost:7352/v1) into PicoClaw's config.json on first boot.
  • Desktop Activation: Created and deployed ModelRelay.desktop, enabling a one-click terminal launcher for the relay service.
  • Reliability Fixes: Added environment preparation steps for Node.js/NPM to ensure the global modelrelay package runs without permission issues.

3. 📝 Documentation & UX

  • README Enhancements:
    • Added a dedicated section for ModelRelay explaining its role as an intelligent bridge for non-OpenAI providers.
    • Highlighted benefits: Unified interface, smart routing (auto-fastest), and zero-config deployment.
    • Reprioritized the "Quick Start" key benefits to emphasize the pre-configured nature of the environment.
  • Improved UX Path: Added instructions for users to easily switch between standard Gemini/OAuth and the new ModelRelay path in the WebUI.

📂 Files Modified

  • New: docker/common.sh
  • New: docker/ModelRelay.desktop
  • Updated: docker/start-modelrelay.sh
  • Updated: docker/start-picoclaw.sh
  • Updated: docker/Dockerfile
  • Updated: README.md

✅ Verification

  • Shared sync_desktop_file correctly handles creation/sync of files in /config.
  • ModelRelay is automatically available in the PicoClaw Model list upon launch.
  • Desktop shortcuts for both services appear and function as expected.

Copilot AI review requested due to automatic review settings April 18, 2026 16:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors WebTop startup shell logic to reuse a shared desktop-file syncing utility and adds first-class ModelRelay support (install, autostart shortcut, and PicoClaw config injection) to make ModelRelay available by default inside the container.

Changes:

  • Introduces docker/common.sh with a reusable sync_desktop_file helper and updates PicoClaw startup to use it.
  • Adds ModelRelay installation + desktop/autostart integration and attempts to auto-inject a modelrelay entry into PicoClaw’s config on boot.
  • Updates Docker image build to include Node.js + ModelRelay and extends README documentation for the new workflow.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
docker/start-picoclaw.sh Sources shared helper and uses it to install PicoClaw desktop/autostart entries.
docker/start-modelrelay.sh New init script: syncs ModelRelay desktop entries, prepares npm perms, and injects modelrelay into PicoClaw config.
docker/common.sh New shared sync_desktop_file function (mkdir/chown + content-change replacement).
docker/ModelRelay.desktop New launcher entry to run ModelRelay in a terminal.
docker/Dockerfile Adds Node stage, installs ModelRelay globally, and copies init/desktop assets into /custom-cont-init.d.
README.md Documents ModelRelay integration and updates feature list / quick-start notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker/start-modelrelay.sh
Comment on lines +33 to +36
(
sleep 15
add_model_if_missing "/config/.picoclaw/config.json"
chown abc:abc "/config/.picoclaw/config.json"
sync_desktop_file "$SRC" "/config/Desktop/ModelRelay.desktop"

# Add modelrelay model to picoclaw's config
# /config/picoclaw/config.json
Comment thread docker/Dockerfile Outdated
Comment thread README.md
- **Unified Interface**: Interact with Google Gemini, Anthropic Claude, or any other provider using the standard OpenAI client format.
- **Smart Routing**: Pre-configured to use `openai/auto-fastest`, automatically selecting the most responsive model for your task.
- **Zero-Touch Config**: On first boot, WebTop automatically injects ModelRelay into PicoClaw's model list. You just select the `modelrelay` model in the WebUI and start chatting.
- **Developer Friendly**: Test different LLM backends without changing picoClaw's model config.
Comment thread docker/start-picoclaw.sh Outdated
mkdir -p /config/Desktop
chown abc:abc /config/.config/autostart
chown abc:abc /config/Desktop
source /custom-cont-init.d/common.sh
Comment thread docker/start-modelrelay.sh Outdated
@@ -0,0 +1,37 @@
#!/bin/bash
source /custom-cont-init.d/common.sh
Comment thread docker/start-modelrelay.sh
gitricko and others added 2 commits April 18, 2026 12:54
let see if the image blowup

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gitricko gitricko merged commit e7d3dbb into main Apr 18, 2026
2 checks passed
@gitricko gitricko deleted the modelrelay branch April 18, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants