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

7
ai/Dockerfile.webui Normal file
View File

@@ -0,0 +1,7 @@
FROM ghcr.io/open-webui/open-webui:main
# Install paramiko for SFTP functionality
RUN pip install --no-cache-dir paramiko
# Create .ssh directory
RUN mkdir -p /app/.ssh && chmod 700 /app/.ssh