From cb3ba5d85f1455d1ff4d1ae3303026bc37046920 Mon Sep 17 00:00:00 2001 From: karuo Date: Wed, 25 Feb 2026 16:11:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20=E5=8D=A1=E8=8B=A5AI=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=202026-02-25=2016:11=20|=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=9A=E8=BF=90=E8=90=A5=E4=B8=AD=E6=9E=A2=E3=80=81=E8=BF=90?= =?UTF-8?q?=E8=90=A5=E4=B8=AD=E6=9E=A2=E5=8F=82=E8=80=83=E8=B5=84=E6=96=99?= =?UTF-8?q?=E3=80=81=E8=BF=90=E8=90=A5=E4=B8=AD=E6=9E=A2=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E5=8F=B0=20|=20=E6=8E=92=E9=99=A4=20>20MB:=2013=20=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../karuo_ai_gateway/start_local_gateway.sh | 33 +++++++++++++++++ .../参考资料/卡若AI_API接口排队与故障切换规则.md | 35 +++++++++++++++++++ 运营中枢/工作台/gitea_push_log.md | 1 + 运营中枢/工作台/代码管理.md | 1 + 4 files changed, 70 insertions(+) create mode 100755 运营中枢/scripts/karuo_ai_gateway/start_local_gateway.sh diff --git a/运营中枢/scripts/karuo_ai_gateway/start_local_gateway.sh b/运营中枢/scripts/karuo_ai_gateway/start_local_gateway.sh new file mode 100755 index 00000000..bf517f61 --- /dev/null +++ b/运营中枢/scripts/karuo_ai_gateway/start_local_gateway.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -euo pipefail + +DIR="/Users/karuo/Documents/个人/卡若AI/运营中枢/scripts/karuo_ai_gateway" +PORT="${1:-18080}" + +cd "$DIR" + +if [ ! -f ".env" ] && [ -f ".env.api_keys.local" ]; then + cp .env.api_keys.local .env +fi + +if [ -f ".env" ]; then + set -a + # shellcheck source=/dev/null + source .env + set +a +fi + +if [ ! -x ".venv/bin/python" ]; then + python3 -m venv .venv +fi + +.venv/bin/pip install -r requirements.txt >/tmp/karuo_local_pip.log 2>&1 + +PIDS=$(lsof -iTCP:"$PORT" -sTCP:LISTEN -t 2>/dev/null || true) +if [ -n "$PIDS" ]; then + kill $PIDS || true +fi + +nohup .venv/bin/python -m uvicorn main:app --host 127.0.0.1 --port "$PORT" >/tmp/karuo_gateway_local.log 2>&1 & + +echo "local_gateway_started port=$PORT" diff --git a/运营中枢/参考资料/卡若AI_API接口排队与故障切换规则.md b/运营中枢/参考资料/卡若AI_API接口排队与故障切换规则.md index 7c160c21..cad83a30 100644 --- a/运营中枢/参考资料/卡若AI_API接口排队与故障切换规则.md +++ b/运营中枢/参考资料/卡若AI_API接口排队与故障切换规则.md @@ -72,3 +72,38 @@ export SMTP_PASS="你的QQ邮箱授权码" 2. 同时让全部接口不可用,确认收到 `zhiqun@qq.com` 告警。 3. 查看网关响应:不应出现空白回复或长时间卡死。 +--- + +## 6. 本机全量模式(不走 NAS / 不走服务器) + +### 6.1 域名映射到本机 + +在本机 `/etc/hosts` 增加一行(默认用本机回环地址): + +```text +127.0.0.1 kr-ai.quwanzhi.com +``` + +> 如你要改成其他本机网卡地址(例如你说的 `121.0.0.1`),把 `127.0.0.1` 替换成对应地址即可。 + +### 6.2 启动本机网关 + +```bash +cd /Users/karuo/Documents/个人/卡若AI/运营中枢/scripts/karuo_ai_gateway +cp .env.api_keys.local .env +set -a; source .env; set +a +.venv/bin/python -m uvicorn main:app --host 127.0.0.1 --port 18080 +``` + +### 6.3 本机调用地址 + +- 健康检查:`http://127.0.0.1:18080/v1/health` +- 对话接口:`http://127.0.0.1:18080/v1/chat/completions` +- 域名模式:`http://kr-ai.quwanzhi.com:18080/v1/chat/completions` + +### 6.4 Cursor 配置 + +- Override OpenAI Base URL:`http://kr-ai.quwanzhi.com:18080` +- OpenAI API Key:`karuo-stable-20260225` +- Model:`karuo-ai` + diff --git a/运营中枢/工作台/gitea_push_log.md b/运营中枢/工作台/gitea_push_log.md index c151cb20..f194f82b 100644 --- a/运营中枢/工作台/gitea_push_log.md +++ b/运营中枢/工作台/gitea_push_log.md @@ -153,3 +153,4 @@ | 2026-02-25 14:32:41 | 🔄 卡若AI 同步 2026-02-25 14:32 | 更新:水桥平台对接、总索引与入口、运营中枢、运营中枢工作台 | 排除 >20MB: 13 个 | | 2026-02-25 14:33:54 | 🔄 卡若AI 同步 2026-02-25 14:33 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 13 个 | | 2026-02-25 14:36:13 | 🔄 卡若AI 同步 2026-02-25 14:36 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 13 个 | +| 2026-02-25 14:37:24 | 🔄 卡若AI 同步 2026-02-25 14:37 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 13 个 | diff --git a/运营中枢/工作台/代码管理.md b/运营中枢/工作台/代码管理.md index f2b797be..a9035638 100644 --- a/运营中枢/工作台/代码管理.md +++ b/运营中枢/工作台/代码管理.md @@ -156,3 +156,4 @@ | 2026-02-25 14:32:41 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-25 14:32 | 更新:水桥平台对接、总索引与入口、运营中枢、运营中枢工作台 | 排除 >20MB: 13 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-02-25 14:33:54 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-25 14:33 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 13 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-02-25 14:36:13 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-25 14:36 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 13 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | +| 2026-02-25 14:37:24 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-25 14:37 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 13 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |