feat: add SFTP integration for saving code to local disk

Added custom Open WebUI function for SSH/SFTP file operations:

**New Function: save_to_disk.py**
- save_file(): Write generated code to local filesystem via SFTP
- read_file(): Read files from local disk
- list_files(): List directory contents
- Configurable via Valves (host, port, username, paths)

**Custom Dockerfile (Dockerfile.webui)**
- Based on ghcr.io/open-webui/open-webui:main
- Installs paramiko library for SSH/SFTP support
- Creates .ssh directory for key storage

**Configuration Updates**
- Mount SSH private key from host (/root/.ssh/id_rsa)
- Mount functions directory for custom tools
- Build custom image with SFTP capabilities

**Usage in Open WebUI**
Claude can now use these tools to:
- Generate code and save it directly to your local disk
- Read existing files for context
- List project directories
- Create new files in any project

Default base path: /home/valknar/Projects
Authentication: SSH key-based (passwordless)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-08 23:07:11 +01:00
parent 424e6d044d
commit 5818644c1a
3 changed files with 208 additions and 1 deletions

View File

@@ -24,7 +24,10 @@ services:
# Open WebUI - ChatGPT-like interface for AI models
webui:
image: ${AI_WEBUI_IMAGE:-ghcr.io/open-webui/open-webui:main}
build:
context: .
dockerfile: ./ai/Dockerfile.webui
image: ${AI_WEBUI_IMAGE:-ai_webui_custom:latest}
container_name: ${AI_COMPOSE_PROJECT_NAME}_webui
restart: unless-stopped
environment:
@@ -63,6 +66,8 @@ services:
volumes:
- ai_webui_data:/app/backend/data
- ./ai/functions:/app/backend/data/functions:ro
- /root/.ssh/id_rsa:/app/.ssh/id_rsa:ro
depends_on:
- ai_postgres
- litellm