跳至主要內容

Multica

言午日尧耳总大约 2 分钟AImulticaAIAgent

Multica

介绍

自部署

官方部署

# 加载代码
git clone https://github.com/multica-ai/multica.git
cd multica

# (可选)复制环境变量文件
cp .env.example .env

# 启动服务(使用.env环境变量)
make selfhost

  • 启动后
    • 后端:http://localhost:8080
    • 前端:http://localhost:3000
  • 登录
    • 填写注册邮箱
    • 打开后端服务日志,日志中会打印验证码

服务端配置

  • 修改".env"配置文件
  • 该文件是默认从.env.example自动生成的
# 后端端口号
# PORT=8080
# FRONTEND_PORT=3000

# 改为自己定义的端口号
PORT=10001
FRONTEND_PORT=10002

跨机访问

multica.example.com {
    # WebSocket 路由——必须在 catch-all 之前
    @ws path /ws /ws/*
    handle @ws {
        reverse_proxy 127.0.0.1:8080 {
            flush_interval -1
        }
    }

    # Backend API
    handle /api/* {
        reverse_proxy 127.0.0.1:8080
    }

    # 其它请求 → 前端
    reverse_proxy 127.0.0.1:3000
}

跨机访问(邪修版)

  • 直接修改docker compose文件
    • 文件:docker-compose.selfhost.yml
    • 直接删除"127.0.0.1"
name: multica

services:
  backend:
    ports:
      # - "127.0.0.1:${BACKEND_PORT:-${API_PORT:-${SERVER_PORT:-${PORT:-8080}}}}:8080"
      - "${BACKEND_PORT:-${API_PORT:-${SERVER_PORT:-${PORT:-8080}}}}:8080"
        
  frontend:
    ports:
      # - "127.0.0.1:${FRONTEND_PORT:-3000}:3000"
      - "${FRONTEND_PORT:-3000}:3000"
  • 重启服务
docker compose -f docker-compose.selfhost.yml down

make selfhost

Agent

安装cli

# Linux
curl -fsSL https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.sh | bash

本机快速加入Multica

  • 仅限本人自己部署
  • 打开Multica页面
    • 配置 > 运行时 > 添加电脑
# 接入自部署服务
multica setup self-host

# 自定义端口(服务端的端口)
multica setup self-host --port 10001 --frontend-port 10002

# 其他帮助信息
multica setup --help
multica setup self-host --help

加入已部署Multica

  • 打开Multica页面
    • 配置 > 设置 > 我的账号 > API Token
    • 创建一个Token
  • 添加电脑
    • 配置 > 运行时 > 添加电脑
    • 点击"那台电脑打不开浏览器?"
  • 得到如下命令
# 设置地址
multica config set server_url http://localhost:10002
multica config set app_url http://localhost:10002
# 设置连接token
multica login --token <YOUR_TOKEN>

# 启动
multica daemon start
# 重启
multica daemon restart

配置文件

cli配置文件

  • 地址:~/.multica/config.json
{
  "app_url": "http://localhost:10002",
  "server_url": "http://localhost:10001"
}

桌面端配置文件

  • 地址:~/.multica/desktop.json
{
  "schemaVersion": 1,
  "appUrl": "http://localhost:10002",
  "apiUrl": "http://localhost:10001",
  "wsUrl": "ws://localhost:10001/ws"
}