Sign inSign up

yshtcn/ollama-proxy

By yshtcn

•Updated over 1 year ago

Image
0

1.2K

yshtcn/ollama-proxy repository overview

⁠Ollama Proxy

智能代理服务器,用于管理和优化本地部署的 Ollama 服务。专为个人用户设计,实现节能与服务可用性的完美平衡。

⁠主要特性

  • 智能唤醒:自动唤醒休眠中的 Ollama 服务器
  • 模型列表缓存:即使在服务器休眠时也能快速响应
  • 动态超时控制:针对不同类型的请求优化响应时间
  • 支持远程唤醒:可与 WolGoWeb 等网络唤醒工具集成

⁠快速开始

docker run -d \
  -p 11434:11434 \
  -e OLLAMA_URL=http://localhost:11434 \
  -e WAKE_URL=http://localhost:11434/api/generate \
  -e TIMEOUT_SECONDS=10 \
  -e PORT=11434 \
  yshtcn/ollama-proxy:latest

使用 Docker Compose

version: '3'
services:
  ollama-proxy:
    image: yshtcn/ollama-proxy:latest
    container_name: ollama-proxy
    ports:
      - "11434:11434"
    environment:
      - OLLAMA_URL=${OLLAMA_URL:-http://localhost:11434}
      - WAKE_URL=${WAKE_URL:-http://localhost:11434/api/generate}
      - TIMEOUT_SECONDS=${TIMEOUT_SECONDS:-10}
      - PORT=${PORT:-11434}
      - WAKE_INTERVAL=${WAKE_INTERVAL:-10}
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:11434/health"]
      interval: 30s
      timeout: 10s
      retries: 3

⁠环境变量

变量说明默认值
OLLAMA_URLOllama服务器URLhttp://localhost:11434⁠
WAKE_URL唤醒服务器URLhttp://localhost:11434/api/generate⁠
TIMEOUT_SECONDS简单请求超时时间(秒)10
PORT代理服务器端口11434
WAKE_INTERVAL唤醒间隔时间(分钟)10

⁠源代码

完整源代码和文档请访问:GitHub - yshtcn/OllamaProxy⁠

Tag summary

Content type

Image

Digest

sha256:8934ebbcc…

Size

48.9 MB

Last updated

over 1 year ago

docker pull yshtcn/ollama-proxy