🔄 卡若AI 同步 2026-03-10 23:34 | 更新:金仓、卡木、运营中枢工作台 | 排除 >20MB: 11 个

This commit is contained in:
2026-03-10 23:34:53 +08:00
parent 470765797e
commit 5779dc5539
5 changed files with 139 additions and 5 deletions

View File

@@ -13,11 +13,11 @@ services:
- OLLAMA_HOST=0.0.0.0
volumes:
- ollama-data:/root/.ollama
# 小模型 1.5b 1GB3b 约 2GB,按需调整内存限制
# 推荐跑 qwen2.5:3b2GB3b 3GB 运行内存,故限 5G
deploy:
resources:
limits:
memory: 4G
memory: 5G
volumes:
ollama-data:

View File

@@ -1,11 +1,56 @@
# 公司 NAS 千问小模型 API 配置说明
> 部署位置:公司 NAS Dockerollama-nas 容器)
> 模型qwen2.5:1.5b
> 内网/外网均可调用,无需 API Key
---
## 公司 NAS 配置与推荐模型
| 项目 | 说明 |
|------|------|
| **型号** | Synology DS1825+ |
| **CPU** | AMD Ryzen Embedded V1500B4 核 8 线程) |
| **内存** | 8GBOllama 容器限制 5GB |
| **推荐模型** | **qwen2.5:3b**(效果更好,约 2GB适合 5GB 内存) |
| **备选模型** | qwen2.5:1.5b(更省内存,约 1GB |
已在 NAS 上安装 **qwen2.5:3b** 作为默认推荐,其他终端/应用直接选用该模型即可。
---
## 零、配置到其他地方的速查(复制即用)
| 配置项 | 外网(推荐) | 内网(与 NAS 同网时) |
|--------|--------------|------------------------|
| **BASE URL** | `http://open.quwanzhi.com:11401` | `http://192.168.1.201:11434` |
| **OpenAI 兼容 Base URL** | `http://open.quwanzhi.com:11401/v1` | `http://192.168.1.201:11434/v1` |
| **API Key** | 无需,可填 `ollama` 占位 | 同上 |
| **推荐模型** | `qwen2.5:3b` | 同上 |
| **备选模型** | `qwen2.5:1.5b` | 同上 |
- **进程**Docker 容器名 `ollama-nas`,镜像 `ollama/ollama:latest`,端口 11434。
- **编排路径**`/volume1/docker/ollama/docker-compose.yml`
- **启动/重启**NAS 上 `sudo docker compose -f /volume1/docker/ollama/docker-compose.yml up -d``sudo docker start ollama-nas`
### 在 OpenAI 兼容客户端中填写示例
- **Base URL**`http://open.quwanzhi.com:11401/v1`
- **API Key**`ollama`或不填Ollama 不校验)
- **Model**`qwen2.5:3b`(推荐)或 `qwen2.5:1.5b`
### 环境变量(脚本/应用)
```bash
# 外网
export OLLAMA_BASE_URL="http://open.quwanzhi.com:11401"
# 内网
export OLLAMA_BASE_URL="http://192.168.1.201:11434"
```
---
## 一、接口地址
| 环境 | 基础 URL | 说明 |
@@ -138,5 +183,6 @@ print(r.choices[0].message.content)
|------|-----|
| 外网 Base URL | `http://open.quwanzhi.com:11401` |
| 内网 Base URL | `http://192.168.1.201:11434` |
| 默认模型 | `qwen2.5:1.5b` |
| 推荐模型 | `qwen2.5:3b` |
| 备选模型 | `qwen2.5:1.5b` |
| 认证 | 无(内网服务,外网经 frp 暴露,按需在 frp 或上层加鉴权) |

View File

@@ -78,6 +78,40 @@ CORRECTIONS = {
'私余': '私域', '统安': '同安', '信一下': '线上', '头里': '投入',
'幅画': '负责', '施育': '私域', '经历论': '净利润', '成于': '乘以',
'马的': '码的', '猜济': '拆解', '巨圣': '矩阵', '货客': '获客',
'甲为师': 'AI助手', '小龙俠': '小龙虾', '小龍俠': '小龙虾',
'小龍蝦': '小龙虾', '龍蝦': '龙虾', '小龙虾': '深度AI',
'基因交狼': '技能包', '基因交流': '技能传授', '颗色': 'Cursor',
'蝌蚁': '科技AI', '千万': '千问', '': 'Claude', '豆包': 'AI工具',
'受伤命': '搜索引擎', '货客': '获客', '受上': 'Soul上',
'搜上': 'Soul上', '售上': 'Soul上', '寿上': 'Soul上',
'瘦上': 'Soul上', '亭上': 'Soul上', '这受': '这Soul',
'龙虾': '深度AI', '克劳德': 'Claude',
}
# 各平台违禁词 → 谐音/替代词(用于字幕、封面、文件名)
# 原则:意思不变,表达更安全,避免平台限流/封号
PLATFORM_VIOLATIONS = {
# 网络访问
'科学上网': '特殊网络访问',
'翻墙': '访问海外工具',
'梯子': '访问工具',
'VPN': '网络工具',
# 资金/收益(部分平台敏感)
'引流': '涌流',
'拉人': '邀请',
'加微信': '加联系方式',
'私聊': '后台联系',
# 内容规范
'炸房': '被限流',
'封号': '账号受限',
'洗稿': '参考改写',
# 灰色表述
'灰色': '特殊',
'黑产': '地下产业',
'套利': '差价空间',
# 平台专属敏感
'API': 'A接口',
'token消耗': '算力成本',
}
# 语助词列表(需清理,含常见口头禅)
@@ -235,6 +269,54 @@ def clean_filler_words(text):
result = re.sub(r'[,]+', '', result).strip(' ,')
return result
def apply_platform_safety(text: str) -> str:
"""将各平台违禁词/敏感词替换为安全谐音词,适用于字幕、封面、文件名。
按词长降序替换,避免短词截断长词。
"""
if not text:
return text
result = str(text)
# 先做 CORRECTIONS转录错误修正再做 VIOLATIONS平台安全替换
for w, c in sorted(CORRECTIONS.items(), key=lambda x: len(x[0]), reverse=True):
result = result.replace(w, c)
for w, c in sorted(PLATFORM_VIOLATIONS.items(), key=lambda x: len(x[0]), reverse=True):
result = result.replace(w, c)
return result
def improve_subtitle_punctuation(text: str) -> str:
"""为字幕句子补充标点,让意思更清晰。
规则:
1. 疑问句(含疑问词)加问号
2. 感叹、强调语气加感叹号
3. 普通陈述句末加句号(如果长度 >= 5
4. 修正多余标点
"""
t = text.strip()
if not t:
return t
# 末尾已有标点则不重复加
if t and t[-1] in ',。?!,.:!?':
return apply_platform_safety(t)
# 疑问词检测
question_words = ('', '', '', '', '', '什么', '怎么', '为什么',
'', '哪里', '', '', '多少', '是否', '可以吗', '对吗')
is_question = any(t.endswith(w) for w in question_words) or '?' in t or '' in t
# 感叹语气
exclaim_patterns = ('', '', '', '完全', '绝对', '必须', '一定', '非常', '超级')
is_exclaim = any(t.startswith(p) for p in exclaim_patterns) and len(t) >= 6
# 加标点
if is_question:
t = t + ''
elif is_exclaim:
t = t + ''
elif len(t) >= 5:
t = t + ''
return apply_platform_safety(t)
def parse_srt_for_clip(srt_path, start_sec, end_sec):
"""解析SRT提取指定时间段的字幕"""
with open(srt_path, 'r', encoding='utf-8') as f:
@@ -802,6 +884,8 @@ def enhance_clip(clip_path, output_path, highlight_info, temp_dir, transcript_pa
if m:
raw_title = m.group(1).strip()
hook_text = _normalize_title_for_display(raw_title) or raw_title or '精彩切片'
# 封面文字同样做安全处理
hook_text = apply_platform_safety(hook_text)
cover_duration = STYLE['cover']['duration']
# 竖屏成片:封面/字幕按 498x1080 做,叠在裁切区域,文字与字幕在竖屏上完整且居中
@@ -847,7 +931,9 @@ def enhance_clip(clip_path, output_path, highlight_info, temp_dir, transcript_pa
print(f" ✓ 字幕解析 ({len(subtitles)}条),将烧录为随语音走动的字幕", flush=True)
for i, sub in enumerate(subtitles):
img_path = os.path.join(temp_dir, f'sub_{i:04d}.png')
create_subtitle_image(sub['text'], out_w, out_h, img_path)
# 应用违禁词替换 + 标点优化(让字幕更清晰、安全)
safe_text = improve_subtitle_punctuation(sub['text'])
create_subtitle_image(safe_text, out_w, out_h, img_path)
sub_images.append({'path': img_path, 'start': sub['start'], 'end': sub['end']})
if sub_images:
print(f" ✓ 字幕图片 ({len(sub_images)}张)", flush=True)

View File

@@ -275,3 +275,4 @@
| 2026-03-10 20:05:38 | 🔄 卡若AI 同步 2026-03-10 20:05 | 更新:运营中枢工作台 | 排除 >20MB: 11 个 |
| 2026-03-10 20:26:50 | 🔄 卡若AI 同步 2026-03-10 20:26 | 更新:卡木、运营中枢工作台 | 排除 >20MB: 11 个 |
| 2026-03-10 20:45:03 | 🔄 卡若AI 同步 2026-03-10 20:45 | 更新:卡木、运营中枢工作台 | 排除 >20MB: 11 个 |
| 2026-03-10 20:55:38 | 🔄 卡若AI 同步 2026-03-10 20:55 | 更新:卡木、运营中枢工作台 | 排除 >20MB: 11 个 |

View File

@@ -278,3 +278,4 @@
| 2026-03-10 20:05:38 | 成功 | 成功 | 🔄 卡若AI 同步 2026-03-10 20:05 | 更新:运营中枢工作台 | 排除 >20MB: 11 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |
| 2026-03-10 20:26:50 | 成功 | 成功 | 🔄 卡若AI 同步 2026-03-10 20:26 | 更新:卡木、运营中枢工作台 | 排除 >20MB: 11 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |
| 2026-03-10 20:45:03 | 成功 | 成功 | 🔄 卡若AI 同步 2026-03-10 20:45 | 更新:卡木、运营中枢工作台 | 排除 >20MB: 11 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |
| 2026-03-10 20:55:38 | 成功 | 成功 | 🔄 卡若AI 同步 2026-03-10 20:55 | 更新:卡木、运营中枢工作台 | 排除 >20MB: 11 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |