🔄 卡若AI 同步 2026-02-21 13:04 | 更新:金仓、水桥平台对接、运营中枢工作台 | 排除 >20MB: 5 个

This commit is contained in:
2026-02-21 13:04:54 +08:00
parent d2fbde0920
commit 3ef5ce9578
14 changed files with 933 additions and 11 deletions

View File

@@ -109,6 +109,7 @@ python3 "/Users/karuo/Documents/个人/卡若AI/01_卡资/金仓_存储
- **SSH**`ssh -p 22022 -i "服务器管理项目/Steam/id_ed25519" root@43.139.27.93`(私钥须 `chmod 600`
- 本机快速检查:`ping 43.139.27.93``nc -zv 43.139.27.93 22022`
- 服务器内诊断与限流:在 **宝塔面板终端** 执行文档「六」中 6.16.3 命令(连接数、按 IP 统计、Nginx 限速)。
- **502 修复(如 soul.quwanzhi.com/admin**API 方式运行 `scripts/kr宝塔_宝塔API_修复502.py`(需 API 白名单);或到 kr宝塔 **宝塔面板 → 终端** 执行 `nginx -t && nginx -s reload`在「Node 项目」中重启 soul 相关项目。详见文档 6.6。
### 5. 常用诊断命令kr宝塔等

View File

@@ -147,7 +147,78 @@ limit_rate 500k; # 单连接限速 500KB/s可按需改
改完后 `nginx -t && nginx -s reload`
### 6.4 腾讯云控制台可做
### 6.4 列出占满带宽的程序 / 端口 / 网站及占用比例
在服务器上运行**带宽占用排查脚本**,会输出:监听端口与进程、按端口/进程的连接数占比(≈ 带宽占比、Nginx 站点、Node/PM2 进程、以及若已安装 nethogs 的实时带宽占比。
在 kr宝塔 **宝塔面板 → 终端** 执行脚本。两种方式任选:
- **方式一**:把脚本上传到服务器后执行
`bash /路径/kr宝塔_带宽占用排查.sh`
- **方式二**:在本机打开脚本,全文复制到宝塔终端粘贴执行
脚本路径:`01_卡资/金仓_存储备份/服务器管理/scripts/kr宝塔_带宽占用排查.sh`脚本会列出:
- **【1】监听端口与进程**可能占带宽的服务Nginx、Node、宝塔、SSH 等)
- **【2】按端口连接数占比**:各端口当前连接数及占比(近似该端口占用带宽比例)
- **【3】按进程连接数占比**:各 PID 连接数及占比(近似该程序占用带宽比例)
- **【4】Nginx 站点**:端口 → 域名/网站
- **【5】Node/PM2 进程**:常见占带宽应用
- **【6】实时带宽**:若已安装 nethogs采样 5 秒得到各进程实时 KB/s 占比
**说明**:无 nethogs 时,用「连接数占比」近似「带宽占比」;精确带宽以 nethogs 或宝塔「监控」为准。
### 6.5 可能占满带宽的程序 / 端口 / 网站清单kr宝塔 当前)
以下为服务器上**正在监听**的程序与端口,均可能产生带宽占用。实时「带宽占比」需在宝塔终端运行上面脚本或 `nethogs -t`
| 类型 | 程序/进程 | 监听端口 | 说明 / 对应网站 |
|------|-----------|----------|------------------|
| Web 入口 | nginx | 80, 443, 888, 19999 | 所有 HTTPS/HTTP 流量经此转发;站点见下表 |
| Node 应用 | next-server | 3000, 3001, 3005, 3015, 3031, 3036, 3043, 3045, 3050, 3055, 3081, 3305 | 多个 Next.js 站点soul、zhiji、dlm、word、wzdj、玩值大屏、神射手、AITOUFA 等) |
| 后端 API | soul-api | 8080, 8081 | soul 相关接口 |
| 网关/内网 | python3 | 8000(127.0.0.1) | 卡若AI 网关等 |
| 面板/系统 | BT-Panel | 9988 | 宝塔面板 |
| 面板/系统 | sshd | 22022 | SSH |
| 数据库/缓存 | redis-server | 6379 | Redis |
| 数据库/缓存 | mongod | 27017 | MongoDB |
| 其他 | pure-ftpd, master(25), containerd, dockerd | 21, 25, 2375, 37455 | FTP、邮件、Docker |
**端口 → 网站/域名(部分)**80/443 上由 Nginx 按 `server_name` 分发到不同站点例如soul.quwanzhi.com、kr-ai.quwanzhi.com、soulapi.quwanzhi.com、www.quwanzhi.com、ckb.quwanzhi.com、dlm.quwanzhi.com、word.quwanzhi.com、wzdj.quwanzhi.com、zp.quwanzhi.com、zhiji.quwanzhi.com、wz-screen.quwanzhi.com、ai-tf.quwanzhi.com、kr_wb.quwanzhi.com、discuzq.quwanzhi.com、www.lkdie.com、feishu.lkdie.com 等(完整列表见 Nginx 配置目录 `/www/server/panel/vhost/nginx/`)。
**带宽占比**:当前瞬时连接数较少时,无法单次采样得到稳定占比。请在服务器上运行 **6.4 的脚本** 或执行 `nethogs -t` 采样 1030 秒即可得到各进程的实时带宽占比KB/s 或 %)。
### 6.6 502 Bad Gateway 修复(含 soul.quwanzhi.com/admin
**原因**Nginx 能通但上游Node/后端)无响应或挂掉,导致 502。
**方式一:宝塔 API需本机 IP 已加入 kr宝塔 API 白名单)**
```bash
python3 "/Users/karuo/Documents/个人/卡若AI/01_卡资/金仓_存储备份/服务器管理/scripts/kr宝塔_宝塔API_修复502.py"
```
脚本会:重启 Nginx、并尝试重启名称含 soul 的 Node 项目。若报「IP校验失败」请到 kr宝塔 面板 **设置 → API 接口** 将当前公网 IP 加入白名单后重试。
**方式二:在 kr宝塔 宝塔面板终端执行(不依赖 API 白名单)**
```bash
# 1. 重载 Nginx
nginx -t && nginx -s reload
# 2. 重启 soul 相关 Node/PM2按你实际项目名调整
pm2 list
pm2 restart soul # 或 souladmin、soul-api 等
# 若用宝塔「Node 项目」管理,请在面板里对该站点点击「重启」
```
**方式三SSH**(当连接可用时)
```bash
ssh -p 22022 -i "服务器管理/Steam/id_ed25519" root@43.139.27.93 "nginx -s reload; pm2 restart soul"
```
修复后刷新 soul.quwanzhi.com/admin 查看是否恢复。
### 6.7 腾讯云控制台可做
- **升级带宽**:云服务器 → 选择实例 ins-aw0tnqjo → 更多 → 网络/带宽 → 调整带宽。
- **流量/带宽告警**:云监控 → 告警策略,对「公网出带宽」设阈值(如 4 Mbps便于提前发现打满。
@@ -163,3 +234,21 @@ limit_rate 500k; # 单连接限速 500KB/s可按需改
---
**下一步**:在 kr宝塔 面板终端执行「六、6.1」诊断;若连接数或单 IP 异常,按 6.2/6.3 限流;长期可升级带宽或设告警。
---
## 八、高负载 / CPU 满 / 磁盘满 · 已执行处理卡若AI 默认自动)
当负载 100%、CPU 99%、磁盘 89% 时,已通过 SSH 自动执行:
1. **结束高 CPU 进程**:多次结束占用约 3539% CPU 的 `npm start`(会被宝塔 Node 项目自动拉起,需在面板中停用或重启对应项目)。
2. **清理磁盘**:删除 `/www/wwwlogs` 下 7 天前 `.log`;截断大于 50M 的网站日志;清理 `/tmp` 7 天前文件;删除 `/var/log` 7 天前 `.log`;截断 `/var/log/oneav/oneav.log`。网站日志由约 2G 降至约 258M磁盘由约 89% 降至约 87%(约 10G 可用)。
3. **负载与 CPU 来源**:当前负载主要来自多个 `next-server`Node 站点)及反复被拉起的 `npm start`。要持续降压需在宝塔「网站」→「Node 项目」中停用或合并非必要项目,或升级为 4 核。
**一键再执行(在服务器终端)**
```bash
find /www/wwwlogs -name '*.log' -mtime +7 -type f -delete
find /www/wwwlogs -name '*.log' -type f -size +50M -exec truncate -s 0 {} \;
find /tmp -type f -mtime +7 -delete
find /var/log -name '*.log' -mtime +7 -type f -delete
```

View File

@@ -0,0 +1,97 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
kr宝塔 43.139.27.93:通过宝塔 API 修复 502重启 Nginx、重启 soul 相关 Node 项目)。
使用python3 kr宝塔_宝塔API_修复502.py
需将本机 IP 加入 kr宝塔 面板「设置」→「API 接口」白名单。
"""
import time
import hashlib
import json
try:
import requests
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
USE_REQUESTS = True
except ImportError:
import urllib.request
import urllib.parse
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
USE_REQUESTS = False
PANEL_URL = "https://43.139.27.93:9988"
API_KEY = "qcWubCdlfFjS2b2DMT1lzPFaDfmv1cBT"
def sign():
t = int(time.time())
s = str(t) + hashlib.md5(API_KEY.encode()).hexdigest()
return {"request_time": t, "request_token": hashlib.md5(s.encode()).hexdigest()}
def post(endpoint, data=None):
url = PANEL_URL + endpoint
payload = sign()
if data:
payload.update(data)
if USE_REQUESTS:
r = requests.post(url, data=payload, timeout=20, verify=False)
return r.json()
req = urllib.request.Request(url, data=urllib.parse.urlencode(payload).encode())
with urllib.request.urlopen(req, timeout=20) as resp:
return json.loads(resp.read().decode())
def main():
print("=" * 56)
print(" kr宝塔 · 宝塔 API 修复 502soul.quwanzhi.com 等)")
print("=" * 56)
# 1. 重启 Nginx
print("\n【1】重启 Nginx...")
try:
r = post("/system?action=ServiceAdmin", {"name": "nginx", "type": "restart"})
if r.get("status") is True or (isinstance(r.get("msg"), str) and "成功" in r.get("msg", "")):
print(" Nginx 重启成功。")
else:
print(" 响应:", r)
except Exception as e:
if "IP" in str(e) or "校验" in str(e) or "403" in str(e):
print(" ❌ API 白名单未通过。请到 kr宝塔 面板「设置」→「API 接口」将本机公网 IP 加入白名单后重试。")
return 1
print(" 请求异常:", e)
return 1
# 2. 获取 Node 项目列表并重启 soul 相关
print("\n【2】查找并重启 soul 相关 Node 项目...")
try:
r = post("/project/nodejs/get_project_list", {})
if r.get("status") is not True:
print(" 获取项目列表失败或接口不可用:", r.get("msg", r))
else:
data = r.get("data") or r.get("list") or []
if not isinstance(data, list):
data = []
restarted = []
for p in data:
name = (p.get("name") or p.get("project_name") or "").lower()
if "soul" in name or "souladmin" in name or "soul-admin" in name:
proj_name = p.get("name") or p.get("project_name")
try:
post("/project/nodejs/restart_project", {"project_name": proj_name})
restarted.append(proj_name)
except Exception as e2:
print(" 重启 %s 失败: %s" % (proj_name, e2))
if restarted:
print(" 已重启:", ", ".join(restarted))
else:
print(" 未找到名称含 soul 的 Node 项目,或列表为空。若 502 仍存在请在面板「Node 项目」中手动重启 soul 相关项目。")
except Exception as e:
print(" 请求异常:", e)
print("\n" + "=" * 56)
print("请刷新 soul.quwanzhi.com/admin 查看是否恢复。若仍 502请到宝塔面板检查该站点「反向代理」上游是否运行或重启对应 Node/PM2 项目。")
print("=" * 56)
return 0
if __name__ == "__main__":
exit(main())

View File

@@ -0,0 +1,104 @@
#!/bin/bash
# kr宝塔 43.139.27.93:列出可能占满带宽的 程序/端口/网站 及 连接数占比(近似带宽占比)
# 在服务器上执行bash kr宝塔_带宽占用排查.sh 或 宝塔面板 → 终端 粘贴运行
set -e
echo "=============================================================="
echo " kr宝塔 · 带宽占用排查(程序 / 端口 / 网站 · 连接数占比)"
echo "=============================================================="
# 1) 监听中的端口与进程
echo ""
echo "【1】监听端口与对应进程可能对外提供服务的程序"
echo "--------------------------------------------------------------"
ss -tlnp 2>/dev/null | awk 'NR==1 || /LISTEN/ {print}' | while read line; do
if echo "$line" | grep -q "LISTEN"; then
port=$(echo "$line" | awk '{print $4}' | rev | cut -d: -f1 | rev)
pid=$(echo "$line" | grep -oE 'pid=[0-9]+' 2>/dev/null | sed 's/pid=//' | head -1)
if [ -n "$pid" ] && [ "$pid" -eq "$pid" ] 2>/dev/null; then
exe=$(readlink -f /proc/$pid/exe 2>/dev/null || ps -p $pid -o comm= 2>/dev/null)
echo " 端口 $port → PID $pid$exe"
else
echo " $line"
fi
fi
done
# 2) ESTABLISHED 按本地端口统计 → 连接数占比
echo ""
echo "【2】当前连接数按「本地端口」统计占比 ≈ 该服务占用带宽的大致比例)"
echo "--------------------------------------------------------------"
total=$(ss -antn state established 2>/dev/null | wc -l)
[ "$total" -eq 0 ] && total=1
ss -antn state established 2>/dev/null | awk '{print $4}' | sed 's/.*://' | sort | uniq -c | sort -rn | head -25 | while read cnt port; do
pct=$((cnt * 100 / total))
# 解析端口对应服务(常见)
name=""
case "$port" in
80|443) name="(Nginx HTTP/HTTPS)" ;;
9988) name="(宝塔面板)" ;;
22022) name="(SSH)" ;;
8000) name="(常见 Node/网关)" ;;
3000) name="(常见 Node)" ;;
3306) name="(MySQL)" ;;
esac
echo " 端口 $port $name → 连接数 $cnt → 占比 ${pct}%"
done
echo " 总连接数: $total"
# 3) ESTABLISHED 按进程(PID)统计 → 程序维度占比
echo ""
echo "【3】当前连接数按「进程」统计程序维度 ≈ 带宽占比)"
echo "--------------------------------------------------------------"
# 从 ss -antp 提取 pid格式因系统而异
ss -antp state established 2>/dev/null | grep -oE 'pid=[0-9]+' | sed 's/pid=//' | sort | uniq -c | sort -rn | head -20 | while read cnt pid; do
[ -z "$pid" ] && continue
pct=$((cnt * 100 / total))
exe=$(readlink -f /proc/$pid/exe 2>/dev/null || ps -p $pid -o comm= 2>/dev/null)
cmd=$(ps -p $pid -o args= 2>/dev/null | cut -c1-60)
echo " PID $pid 连接数 $cnt (${pct}%) → $exe"
echo " 命令: $cmd"
done
# 4) Nginx 站点与端口(端口 → 网站)
echo ""
echo "【4】Nginx 站点(端口 → 网站/域名)"
echo "--------------------------------------------------------------"
if [ -d /www/server/panel/vhost/nginx ]; then
for f in /www/server/panel/vhost/nginx/*.conf; do
[ -f "$f" ] || continue
name=$(grep -m1 'server_name' "$f" 2>/dev/null | sed 's/.*server_name\s*//;s/;.*//;s/\s.*//')
listen=$(grep -m1 'listen' "$f" 2>/dev/null | sed 's/.*listen\s*//;s/\s.*//;s/;.*//')
root=$(grep -m1 'root ' "$f" 2>/dev/null | sed 's/.*root\s*//;s/;.*//')
[ -z "$name" ] && name="(未配置 server_name)"
echo " $name → listen $listen root $root"
done
else
echo " (未找到 /www/server/panel/vhost/nginx)"
fi
# 5) PM2 / Node 进程(常见占带宽)
echo ""
echo "【5】Node/PM2 进程(常见占带宽应用)"
echo "--------------------------------------------------------------"
if command -v pm2 >/dev/null 2>&1; then
pm2 list 2>/dev/null || true
else
ps aux | grep -E 'node|next|nuxt' | grep -v grep || echo " (未发现 pm2/node 或未在 PATH)"
fi
# 6) 若安装 nethogs可采样几秒得到实时带宽占比
echo ""
echo "【6】实时带宽占比需安装 nethogs采样 5 秒)"
echo "--------------------------------------------------------------"
if command -v nethogs >/dev/null 2>&1; then
echo " 运行: nethogs -t -c 5 (5 秒采样,需 root)"
(timeout 6 nethogs -t -c 5 2>/dev/null || nethogs -t -d 1 -c 5 2>/dev/null) || echo " (请手动执行: nethogs -t)"
else
echo " 未安装 nethogs。安装: yum install nethogs 或 apt install nethogs可得到各进程实时带宽占比。"
fi
echo ""
echo "=============================================================="
echo "说明:连接数占比可近似看作该程序/端口占用带宽的比例;精确带宽请用 nethogs 或宝塔「监控」"
echo "=============================================================="

View File

@@ -1,6 +1,6 @@
{
"access_token": "u-5G.9qZ5QVazXtNeCd0_G9Ql5kUi5k1grMUaaEwA00wC3",
"refresh_token": "ur-75hAReT7B5hUGua_bRUM74l5mWUBk1OpXEaaUMQ00BCm",
"access_token": "u-7C1CncMZl2KpSw4iFE2NlTl5kqqBk1ijMUaaYNM00BO2",
"refresh_token": "ur-7M87WoUqRaaWua55KFRkgol5miWBk1MPP8aaVRw00BO6",
"name": "飞书用户",
"auth_time": "2026-02-20T18:13:31.812446"
"auth_time": "2026-02-21T06:25:07.138984"
}

View File

@@ -0,0 +1,33 @@
【卡若智能纪要】106场 2026-02-21
一、嘉宾与主线
· 退伍军人(刚退伍):问 AI 方向、智能体变现;被建议优先低空经济/无人机培训(补贴 8800、研学/家政/烧烤等有结果赛道,卖智能体为伪概念除非有流量。
· 环保行业/国企专员(零基础):问如何切入 AI建议先用豆包/GPT/Cursor 提效本职工作AI 是工具,结合现有业务赋能(如私域+AI 客服:一人管 50 个微信,前段 AI 筛选分析、真人后接)。
· 5 号分享嘉宾AI 炒股逻辑——中青宝案例(算力/数据经济/元宇宙/华为概念等),结合财报与 K 线;用 AI 做新政、数据与舆情采集做预判;提到 DeepSeek 在量化/超短线/套利上的优势(秒级成交),普通人炒股空间会变窄。
· 古币/银元嘉宾:咸丰大钱、银元特殊版别;做过小型线上拍卖行——线下拍卖抽 20 点、自家私域拍卖群抽 5 点,早期流动性好时收益可观;银元近年跌;用 AI 可问某朝代古币涨跌空间;乡下收货、鉴定(如 PCGS 等)重要;全国炒银元约十几二十万人,小圈子变现。
二、核心内容
· 退伍军人:政策友好(贴息贷款、补贴),更适合低空经济、研学、家政、烧烤等;卖智能体需流量与销售能力,否则不匹配。
· AI 工作提效:从本职工作切入,用 AI 做流程化、文档、剪辑分发等3 天活 3 小时完成;私域+AI 客服(朋友圈、点赞、加友分析、分配流量由 AI 做)。
· AI 炒股:逻辑在预期与预判;国内模型分析逻辑弱,可多用 ClaudeDeepSeek 在数据舆情、策略量化、多因子轮动上强,普通人越来越难。
· 古币/拍卖线上拍卖抽点低5 点)、流动性大时可行;乡下收货、鉴定与圈子是关键;银元有下跌周期。
三、热点切片
· 退伍军人+低空经济/无人机培训(补贴 8800
· 私域+AI 客服:一人管 50 个微信AI 前置筛选与分析。
· AI 炒股:中青宝 14.23、DeepSeek 量化与秒级成交。
· 古币银元+小型线上拍卖行(抽 5 点)、嘉德拍卖一条视频 600 万播放。
四、核心金句
· 「卖智能体是伪概念,除非你有流量、销售厉害。」
· 「AI 是工具,配合你原有业务提效、自动化才有用。」
· 「炒股炒的是预判;用 AI 炒股国内模型别用,逻辑差。」
· 「超短线、套利谁能打得过 DeepSeek秒级成交人做不到。」
· 「线下拍卖抽 20 点,我们私域拍卖抽 5 点,流动性高时很吓人。」
五、下一步
· 退伍军人可查当地低空经济/无人机培训补贴,结合烧烤等实体。
· 零基础先在工作场景用豆包/Cursor 提效,再考虑 AI 项目。
· 派对内继续 510 分钟主题分享,可关注、可快速合作;进资源泡泡群、合作私聊管理。
数据来源soul 派对 106场 20260221.txt

View File

@@ -4,8 +4,9 @@
- 内部会议纪要:写在「内部会议纪要」这一行,按纪要上的日期(如 2月20日填到该日期列。
- 派对今日总结:写在「今日总结」这一行,按派对日期(如 2月19日填到该日期列。
不发飞书群。
用法:python3 feishu_write_minutes_to_sheet.py [内部会议图片路径] [派对总结图片路径]
默认:内部会议 20260220-094434.jpg → 2月20日列派对总结 20260220-094442.png → 2月19日列
用法:
python3 feishu_write_minutes_to_sheet.py [内部会议图片路径] [派对总结图片路径]
python3 feishu_write_minutes_to_sheet.py --party-text 21 [纪要txt路径] # 仅将派对智能纪要文本写入 2月21日 今日总结
"""
import os
import sys
@@ -108,6 +109,20 @@ def _resize_image_if_needed(path, max_bytes=MAX_IMAGE_BYTES):
return data
def update_cell_text(token, range_str, text, value_input_option='USER_ENTERED'):
"""向单元格写入文本(支持换行)。"""
if range_str.count('!') == 1 and ':' not in range_str.split('!')[1]:
range_str = range_str + ':' + range_str.split('!')[1]
url = f'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/{WIKI_TOKEN}/values'
params = {'valueInputOption': value_input_option}
payload = {'valueRange': {'range': range_str, 'values': [[text]]}}
r = requests.put(url, params=params, headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}, json=payload, timeout=15)
try:
return r.status_code, r.json()
except Exception:
return r.status_code, {}
def write_image_to_cell(token, range_str, image_path, name=None):
"""
飞书 v2 写入图片到单元格POST .../values_imagebody 为 JSONimage 为整数数组(字节流)。
@@ -138,6 +153,54 @@ def write_image_to_cell(token, range_str, image_path, name=None):
def main():
# 仅写入派对智能纪要到 2月21日 今日总结
if len(sys.argv) >= 4 and sys.argv[1] == '--party-text' and sys.argv[2] == '21':
summary_path = sys.argv[3].strip()
if not os.path.exists(summary_path):
print('❌ 纪要文件不存在:', summary_path)
sys.exit(1)
with open(summary_path, 'r', encoding='utf-8') as f:
summary_text = f.read().strip()
token = load_token() or refresh_token()
if not token:
print('❌ 无法获取飞书 Token')
sys.exit(1)
vals = read_range(token, f'{SHEET_ID}!A1:AG50')
if not vals or len(vals) < 2:
print('❌ 读取表格失败')
sys.exit(1)
header = vals[0]
col_21 = None
for idx, cell in enumerate(header):
if str(cell).strip() == '21':
col_21 = idx
break
row_party = None
for ri, row in enumerate(vals):
a1 = (row[0] if row and len(row) > 0 else '')
a1 = str(a1 or '').strip()
if '今日总结' in a1:
row_party = ri + 1
break
if col_21 is None or row_party is None:
print('❌ 未找到日期列 21 或「今日总结」行')
sys.exit(1)
range_cell = f'{SHEET_ID}!{_col_letter(col_21)}{row_party}'
code, body = update_cell_text(token, range_cell, summary_text)
if code == 200 and body.get('code') in (0, None):
print(f'✅ 已将派对智能纪要写入「今日总结」2月21日列{range_cell}')
else:
if code == 401 or body.get('code') in (99991677, 99991663):
token = refresh_token()
if token:
code, body = update_cell_text(token, range_cell, summary_text)
if code == 200 and body.get('code') in (0, None):
print('✅ 已将派对智能纪要写入「今日总结」2月21日列')
sys.exit(0)
print('❌ 写入纪要失败:', code, body)
sys.exit(1)
return
image_internal = (sys.argv[1] if len(sys.argv) > 1 else DEFAULT_IMAGE_INTERNAL).strip()
image_party = (sys.argv[2] if len(sys.argv) > 2 else DEFAULT_IMAGE_PARTY).strip()

View File

@@ -0,0 +1,228 @@
#!/usr/bin/env python3
"""
从「派对智能纪要」txt 生成一张长图PNG风格与 101 场一致。
仅生成图片,不发群。
用法:
python3 generate_party_minutes_image.py [纪要txt路径]
python3 generate_party_minutes_image.py # 默认使用同目录 106场派对智能纪要_20260221.txt
输出卡若Ai的文件夹/图片/106场派对智能纪要_20260221.png或按文件名推导
依赖playwright与智能纪要 screenshot.py 相同)
"""
import re
import sys
from pathlib import Path
# 脚本与智能纪要目录
SCRIPT_DIR = Path(__file__).resolve().parent
# 卡若AI 根目录(脚本在 02_卡人/水桥/飞书管理/脚本,上 4 级为根)
KARUO_AI_ROOT = Path(__file__).resolve().parents[4]
INTELLIGENT_MINUTES_SCRIPT = KARUO_AI_ROOT / "04_卡火/火眼_智能追问/智能纪要/脚本"
OUTPUT_IMAGE_DIR = Path("/Users/karuo/Documents/卡若Ai的文件夹/图片")
OUTPUT_HTML_DIR = Path("/Users/karuo/Documents/卡若Ai的文件夹/报告/智能纪要")
def parse_minutes_txt(content: str) -> tuple[str, list[tuple[str, str]]]:
"""解析纪要:返回 (标题, [(区块标题, 区块正文), ...])"""
lines = content.strip().split("\n")
title = ""
sections = []
current_title = ""
current_body: list[str] = []
def flush():
nonlocal current_title, current_body
if current_title or current_body:
sections.append((current_title, "\n".join(current_body).strip()))
current_title = ""
current_body = []
for line in lines:
line = line.rstrip()
# 首行作为总标题(仅在第一行时)
if not title and line.strip() and not re.match(r"^[一二三四五六七八九十]、", line):
title = line.strip()
continue
m = re.match(r"^([一二三四五六七八九十]、[^\s·]+)(.*)$", line)
if m:
flush()
current_title = m.group(1).strip()
rest = m.group(2).strip()
if rest:
current_body.append(rest)
continue
# 正文行:· 条目 或 数据来源 或 任意非空(在已有区块内)
if current_title or current_body:
if line.strip():
current_body.append(line.strip())
flush()
if not title and sections:
title = sections[0][0] if sections[0][0] else "派对智能纪要"
return title, sections
def escape_html(s: str) -> str:
return s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;").replace("\n", "<br/>")
def build_html(title: str, sections: list[tuple[str, str]]) -> str:
"""生成 101 场风格的整页 HTML"""
section_colors = ["blue", "orange", "green", "purple", "red", "blue"]
section_icons = ["👤", "📌", "🔥", "💬", "", "📎"]
sections_html = ""
for i, (sec_title, body) in enumerate(sections):
color = section_colors[i % len(section_colors)]
icon = section_icons[i % len(section_icons)]
body_esc = escape_html(body)
sections_html += f"""
<div class="block">
<div class="section-head">
<span class="section-num {color}">{icon}</span>
<span class="section-title">{escape_html(sec_title)}</span>
</div>
<div class="section-body">{body_esc}</div>
</div>
"""
return f"""<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{escape_html(title)}</title>
<style>
:root {{
--blue: #2563eb;
--orange: #ea580c;
--green: #16a34a;
--purple: #7c3aed;
--red: #dc2626;
--bg-page: #fafafa;
--text-primary: #1a1a2e;
--text-secondary: #4b5563;
--white: #ffffff;
}}
* {{ margin: 0; padding: 0; box-sizing: border-box; }}
body {{
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
background: var(--bg-page);
min-height: 100vh;
color: var(--text-primary);
line-height: 1.65;
}}
.container {{ max-width: 720px; margin: 0 auto; padding: 28px 24px; }}
.header {{
background: var(--white);
border-radius: 16px;
box-shadow: 0 4px 20px rgba(0,0,0,0.06);
padding: 28px 32px;
margin-bottom: 24px;
border: 1px solid rgba(0,0,0,0.05);
}}
.header h1 {{ font-size: 1.5rem; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }}
.header .sub {{ font-size: 0.9rem; color: var(--text-secondary); }}
.block {{
background: var(--white);
border-radius: 14px;
box-shadow: 0 4px 16px rgba(0,0,0,0.06);
padding: 20px 24px;
margin-bottom: 20px;
border: 1px solid rgba(0,0,0,0.05);
}}
.section-head {{
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 14px;
padding-bottom: 10px;
border-bottom: 3px solid #e5e7eb;
font-size: 1.1rem;
font-weight: 800;
color: var(--text-primary);
}}
.section-head .section-num {{
display: inline-flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
color: #fff;
border-radius: 8px;
font-size: 0.9rem;
}}
.section-head .section-num.blue {{ background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); }}
.section-head .section-num.orange {{ background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%); }}
.section-head .section-num.green {{ background: linear-gradient(135deg, #16a34a 0%, #15803d 100%); }}
.section-head .section-num.purple {{ background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); }}
.section-head .section-num.red {{ background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }}
.section-body {{
font-size: 0.92rem;
color: var(--text-secondary);
line-height: 1.7;
}}
.section-body br {{ margin: 0.35em 0; }}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>{escape_html(title)}</h1>
<p class="sub">卡若派对智能纪要 · 仅本地生成,不发群</p>
</div>
{sections_html}
</div>
</body>
</html>
"""
def main():
txt_path = (SCRIPT_DIR / "106场派对智能纪要_20260221.txt")
if len(sys.argv) > 1:
txt_path = Path(sys.argv[1]).resolve()
if not txt_path.exists():
print(f"❌ 纪要文件不存在: {txt_path}")
sys.exit(1)
content = txt_path.read_text(encoding="utf-8")
title, sections = parse_minutes_txt(content)
if not sections:
print("❌ 未能解析出有效区块(需要 一、二、三、… 格式)")
sys.exit(1)
OUTPUT_HTML_DIR.mkdir(parents=True, exist_ok=True)
OUTPUT_IMAGE_DIR.mkdir(parents=True, exist_ok=True)
stem = txt_path.stem
html_path = OUTPUT_HTML_DIR / f"{stem}.html"
image_path = OUTPUT_IMAGE_DIR / f"{stem}.png"
html = build_html(title, sections)
html_path.write_text(html, encoding="utf-8")
print(f"✅ 已生成 HTML: {html_path}")
# 调用智能纪要目录下的 screenshot.py
screenshot_py = INTELLIGENT_MINUTES_SCRIPT / "screenshot.py"
if not screenshot_py.exists():
print(f"❌ 未找到截图脚本: {screenshot_py}")
print(" 请确认 04_卡火/火眼_智能追问/智能纪要/脚本/screenshot.py 存在")
sys.exit(1)
import subprocess
ret = subprocess.run(
[sys.executable, str(screenshot_py), str(html_path), "--width", "800", "--output", str(image_path)],
cwd=str(INTELLIGENT_MINUTES_SCRIPT),
)
if ret.returncode != 0:
print("❌ 截图失败(需安装 playwright: pip install playwright && playwright install chromium")
sys.exit(1)
print(f"✅ 派对智能纪要图片已生成: {image_path}")
print(" (未发群,仅本地文件)")
if __name__ == "__main__":
main()

View File

@@ -35,9 +35,11 @@ ROWS = {
'104': [ 'AI创业最赚钱一月分享', 140, 36221, 367, 7, 49, 0, 0, 11, 38 ],
# 105场 2026-02-20截图 138分钟/403进房/54最高在线/31关注/2礼物/24灵魂力小助手 人均10min/互动170推流截图中无填0
'105': [ '创业社群AI培训6980 电竞私域', 138, 0, 403, 10, 170, 2, 24, 31, 54 ],
# 106场 2026-02-21派对已关闭 135分钟/395进房/42最高在线/9关注/3礼物/24灵魂力/33312曝光小助手 7人均/88互动
'106': [ '退伍军人低空经济 AI工作提效', 135, 33312, 395, 7, 88, 3, 24, 9, 42 ],
}
# 场次→按日期列填写时的日期(表头为当月日期 1~31,如 105场 对应 2月20日 → 列名 "20"
SESSION_DATE_COLUMN = {'105': '20'} # 105场 填在 2月20日 列下
# 场次→按日期列填写时的日期(表头为当月日期 1~31
SESSION_DATE_COLUMN = {'105': '20', '106': '21'}
def load_token():
@@ -245,18 +247,20 @@ def main():
LABELS_GROUP = ['主题', '时长(分钟)', 'Soul推流人数', '进房人数', '人均时长(分钟)', '互动数量', '礼物', '灵魂力', '增加关注', '最高在线']
def _maybe_send_group(sess, raw_vals):
if sess != '105':
if sess not in ('105', '106'):
return
day = SESSION_DATE_COLUMN.get(sess, '')
date_label = f'2月{day}' if day else ''
lines = [
'【Soul 派对运营报表】',
f'链接:{OPERATION_REPORT_LINK}',
'',
'105场2月20日)已登记:',
f'{sess}场({date_label})已登记:',
]
for i, label in enumerate(LABELS_GROUP):
val = raw_vals[i] if i < len(raw_vals) else ''
lines.append(f'{label}{val}')
lines.append('数据来源soul 派对 105场 20260220.txt')
lines.append(f'数据来源soul 派对 {sess}场 202602{day}.txt')
msg = '\n'.join(lines)
ok, _ = send_feishu_group_message(FEISHU_GROUP_WEBHOOK, msg)
if ok:

View File

@@ -0,0 +1,165 @@
#!/usr/bin/env python3
"""
将「团队入职流程与新人登记表」飞书 blocks JSON 写入指定飞书知识库子页
本地源文件:运营中枢/工作台/团队入职流程与新人登记表_feishu_blocks.json
使用: python3 upload_wiki_onboarding.py
"""
import os
import sys
import json
import requests
from datetime import datetime
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
CONFIG = {
'APP_ID': 'cli_a48818290ef8100d',
'APP_SECRET': 'dhjU0qWd5AzicGWTf4cTqhCWJOrnuCk4',
'TARGET_WIKI_TOKEN': 'IpPjwts3iiPH5nkg1gLcp2GonUf',
'TOKEN_FILE': os.path.join(SCRIPT_DIR, '.feishu_tokens.json'),
}
JSON_PATH = '/Users/karuo/Documents/个人/卡若AI/运营中枢/工作台/团队入职流程与新人登记表_feishu_blocks.json'
WIKI_URL = f"https://cunkebao.feishu.cn/wiki/{CONFIG['TARGET_WIKI_TOKEN']}"
def load_tokens():
if os.path.exists(CONFIG['TOKEN_FILE']):
with open(CONFIG['TOKEN_FILE']) as f:
return json.load(f)
return {}
def save_tokens(tokens):
with open(CONFIG['TOKEN_FILE'], 'w') as f:
json.dump(tokens, f, ensure_ascii=False, indent=2)
def get_app_token():
r = requests.post("https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal/",
json={"app_id": CONFIG['APP_ID'], "app_secret": CONFIG['APP_SECRET']}, timeout=10)
data = r.json()
return data.get('app_access_token') if data.get('code') == 0 else None
def refresh_token_silent(tokens):
if not tokens.get('refresh_token'):
return None
app_token = get_app_token()
if not app_token:
return None
r = requests.post(
"https://open.feishu.cn/open-apis/authen/v1/oidc/refresh_access_token",
headers={"Authorization": f"Bearer {app_token}", "Content-Type": "application/json"},
json={"grant_type": "refresh_token", "refresh_token": tokens['refresh_token']}, timeout=10)
result = r.json()
if result.get('code') == 0:
data = result.get('data', {})
tokens['access_token'] = data.get('access_token')
tokens['refresh_token'] = data.get('refresh_token')
tokens['auth_time'] = datetime.now().isoformat()
save_tokens(tokens)
return tokens['access_token']
return None
def check_token_valid(token):
if not token:
return False
try:
r = requests.get(
f"https://open.feishu.cn/open-apis/wiki/v2/spaces/get_node?token={CONFIG['TARGET_WIKI_TOKEN']}",
headers={'Authorization': f'Bearer {token}'}, timeout=10)
return r.json().get('code') == 0
except Exception:
return False
def get_token_silent():
tokens = load_tokens()
if tokens.get('access_token') and check_token_valid(tokens['access_token']):
return tokens['access_token']
print("🔄 静默刷新Token...")
new_token = refresh_token_silent(tokens)
if new_token and check_token_valid(new_token):
print("✅ Token刷新成功")
return new_token
print("❌ 无法获取有效Token请先运行 auto_log.py 完成飞书授权")
return None
def load_blocks_from_json():
"""从本地飞书 blocks JSON 加载 children 数组"""
with open(JSON_PATH, 'r', encoding='utf-8') as f:
data = json.load(f)
return data.get('children', [])
def main():
print("=" * 50)
print("📤 上传「团队入职流程与新人登记表」到飞书知识库feishu_blocks.json")
print("=" * 50)
token = get_token_silent()
if not token:
sys.exit(1)
headers = {'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}
# 1. 获取目标节点文档 ID
r1 = requests.get(
f"https://open.feishu.cn/open-apis/wiki/v2/spaces/get_node?token={CONFIG['TARGET_WIKI_TOKEN']}",
headers=headers, timeout=30)
try:
j1 = r1.json()
except Exception as e:
print(f"❌ 解析 get_node 响应失败: {e}, text={r1.text[:300]}")
sys.exit(1)
if j1.get('code') != 0:
print(f"❌ 获取节点失败: {j1.get('msg')}")
sys.exit(1)
doc_id = j1['data']['node']['obj_token']
print(f"✅ 文档 ID: {doc_id}")
# 2. 获取现有 blocks找出根节点下直接子块
r2 = requests.get(
f"https://open.feishu.cn/open-apis/docx/v1/documents/{doc_id}/blocks",
headers=headers, params={'page_size': 100}, timeout=30)
if not r2.text.strip():
items = []
else:
try:
j = r2.json()
except Exception as e:
print(f"❌ 解析 blocks 响应失败: {e}, text={r2.text[:200]}")
sys.exit(1)
if j.get('code') != 0:
print(f"❌ 获取 blocks 失败: {j.get('msg')}")
sys.exit(1)
items = j.get('data', {}).get('items', [])
child_ids = [b['block_id'] for b in items if b.get('parent_id') == doc_id]
# 3. 若有子块则批量删除(先清空再写)
if child_ids:
rd = requests.delete(
f"https://open.feishu.cn/open-apis/docx/v1/documents/{doc_id}/blocks/{doc_id}/children/batch_delete",
headers=headers, json={'block_id_list': child_ids}, timeout=30)
try:
jd = rd.json()
except Exception:
jd = {}
if jd.get('code') != 0:
print(f"⚠️ 清空原内容失败(将追加写入): {jd.get('msg', rd.text[:100])}")
else:
print(f"✅ 已清空原内容({len(child_ids)} 块)")
# 4. 从本地 JSON 加载并写入
content_blocks = load_blocks_from_json()
if not content_blocks:
print("❌ JSON 中 children 为空")
sys.exit(1)
r4 = requests.post(
f"https://open.feishu.cn/open-apis/docx/v1/documents/{doc_id}/blocks/{doc_id}/children",
headers=headers, json={'children': content_blocks, 'index': 1}, timeout=30)
try:
j4 = r4.json()
except Exception as e:
print(f"❌ 解析写入响应失败: {e}, text={r4.text[:200]}")
sys.exit(1)
if j4.get('code') != 0:
print(f"❌ 写入失败: {j4.get('msg')}")
sys.exit(1)
print(f"✅ 已写入 {len(content_blocks)} 个块")
print(f"📎 文档链接: {WIKI_URL}")
print("=" * 50)
if __name__ == "__main__":
main()

View File

@@ -42,3 +42,4 @@
| 2026-02-20 17:44:59 | 🔄 卡若AI 同步 2026-02-20 17:44 | 更新Cursor规则、总索引与入口、运营中枢参考资料、运营中枢技能路由 | 排除 >20MB: 5 个 |
| 2026-02-20 18:17:38 | 🔄 卡若AI 同步 2026-02-20 18:17 | 更新:水桥平台对接、运营中枢参考资料、运营中枢工作台 | 排除 >20MB: 5 个 |
| 2026-02-20 18:29:55 | 🔄 卡若AI 同步 2026-02-20 18:29 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 5 个 |
| 2026-02-20 18:38:29 | 🔄 卡若AI 同步 2026-02-20 18:38 | 更新:金仓、运营中枢工作台 | 排除 >20MB: 5 个 |

View File

@@ -45,3 +45,4 @@
| 2026-02-20 17:44:59 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-20 17:44 | 更新Cursor规则、总索引与入口、运营中枢参考资料、运营中枢技能路由 | 排除 >20MB: 5 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |
| 2026-02-20 18:17:38 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-20 18:17 | 更新:水桥平台对接、运营中枢参考资料、运营中枢工作台 | 排除 >20MB: 5 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |
| 2026-02-20 18:29:55 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-20 18:29 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 5 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |
| 2026-02-20 18:38:29 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-20 18:38 | 更新:金仓、运营中枢工作台 | 排除 >20MB: 5 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |

View File

@@ -0,0 +1,52 @@
# 团队入职流程与新人登记表
> 新加入团队的小伙伴请按以下流程走完,并填写下方登记表。填好后发群或发给管理员。
---
## 一、团队流程(三步)
1. **确定能力及时间**(学习相应的内容)
2. **拉进飞书**
3. **7 天配合**(分配任务、磨合)
---
## 二、新人登记表(请复制下表填写后发群)
| 项目 | 你的填写 |
|------|----------|
| 如何称呼我 | |
| MBTI | |
| 地区 | |
| 你擅长 | (如:剪辑、翻墙、写作、运营等) |
| 电脑/设备 | 苹果 / Windows / 无(选填) |
| 你最赚钱的一个月做的是什么 | |
| 最让有成就感的一个事 | |
| 你人生的转折点 | |
| 我能帮到大家什么 | |
| 我需要什么帮助 | |
---
## 三、纯文字版(方便直接复制到聊天里填)
```
如何称呼我:
MBTI
地区:
你擅长:
电脑/设备:(苹果 / Windows / 无,选填)
你最赚钱的一个月做的是什么:
最让有成就感的一个事:
你人生的转折点:
我能帮到大家什么:
我需要什么帮助:
```
---
*文档位置卡若AI 运营中枢/工作台/团队入职流程与新人登记表.md*
**飞书同步**:已上传至存客宝知识库 → https://cunkebao.feishu.cn/wiki/IpPjwts3iiPH5nkg1gLcp2GonUf
再次同步可运行:`python3 02_卡人/水桥_平台对接/飞书管理/脚本/upload_wiki_onboarding.py`

View File

@@ -0,0 +1,84 @@
{
"description": "飞书 docx blocks用于上传至 https://cunkebao.feishu.cn/wiki/IpPjwts3iiPH5nkg1gLcp2GonUf",
"children": [
{
"block_type": 3,
"heading1": {
"elements": [{"text_run": {"content": "团队入职流程与新人登记表", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 19,
"callout": {
"emoji_id": "bulb",
"background_color": 2,
"border_color": 2,
"elements": [{"text_run": {"content": "新加入团队的小伙伴请按以下流程走完,并填写下方登记表。填好后发群或发给管理员。", "text_element_style": {}}}]
}
},
{
"block_type": 4,
"heading2": {
"elements": [{"text_run": {"content": "一、团队流程(三步)", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 2,
"text": {
"elements": [{"text_run": {"content": "1. 确定能力及时间(学习相应的内容)", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 2,
"text": {
"elements": [{"text_run": {"content": "2. 拉进飞书", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 2,
"text": {
"elements": [{"text_run": {"content": "3. 7 天配合(分配任务、磨合)", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 4,
"heading2": {
"elements": [{"text_run": {"content": "二、新人登记表(请复制下表填写后发群)", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 2,
"text": {
"elements": [{"text_run": {"content": "| 项目 | 你的填写 |\n|------|----------|\n| 如何称呼我 | |\n| MBTI | |\n| 地区 | |\n| 你擅长 | (如:剪辑、翻墙、写作、运营等) |\n| 电脑/设备 | 苹果 / Windows / 无(选填) |\n| 你最赚钱的一个月做的是什么 | |\n| 最让有成就感的一个事 | |\n| 你人生的转折点 | |\n| 我能帮到大家什么 | |\n| 我需要什么帮助 | |", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 4,
"heading2": {
"elements": [{"text_run": {"content": "三、纯文字版(方便直接复制到聊天里填)", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 2,
"text": {
"elements": [{"text_run": {"content": "如何称呼我:\nMBTI\n地区\n你擅长\n电脑/设备:(苹果 / Windows / 无,选填)\n你最赚钱的一个月做的是什么\n最让有成就感的一个事\n你人生的转折点\n我能帮到大家什么\n我需要什么帮助", "text_element_style": {}}}],
"style": {}
}
},
{
"block_type": 2,
"text": {
"elements": [{"text_run": {"content": "文档位置卡若AI 运营中枢/工作台 | 飞书同步https://cunkebao.feishu.cn/wiki/IpPjwts3iiPH5nkg1gLcp2GonUf", "text_element_style": {}}}],
"style": {}
}
}
]
}