lingshu-skill 5.66.0 → 5.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/SKILL-lite.md +1 -1
- package/SKILL-tiny.md +1 -1
- package/SKILL.md +1 -1
- package/cordis-plugin/lingshu-cron/plugin.js +27 -13
- package/cordis-plugin/lingshu-guard/plugin.js +6 -1
- package/cordis-plugin/lingshu-startup/context-pressure.js +129 -110
- package/manifest.json +20 -20
- package/package.json +1 -1
- package/scripts/astrbot_plugin_lingshu/CHECKSUMS.json +8 -8
- package/scripts/astrbot_plugin_lingshu/engine/CHANGELOG.md +28 -0
- package/scripts/astrbot_plugin_lingshu/engine/README.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-lite.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL-tiny.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/SKILL.md +1 -1
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_cloud.py +651 -627
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panel_server.py +32 -13
- package/scripts/astrbot_plugin_lingshu/engine/scripts/panels.py +610 -602
- package/scripts/panel_cloud.py +651 -627
- package/scripts/panel_server.py +32 -13
- package/scripts/panels.py +610 -602
|
@@ -1646,19 +1646,21 @@ def _api_persona_self_model(self, path, data):
|
|
|
1646
1646
|
if not text:
|
|
1647
1647
|
self._json({"ok": False, "error": "缺少 text"}, 400)
|
|
1648
1648
|
return
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1649
|
+
# LS-088(v5.67):在锁内重读、修改、保存——与新增或编辑并发时不会丢失更新
|
|
1650
|
+
with brain._locked(brain.HOME / "persona.json"):
|
|
1651
|
+
p = brain.load_persona()
|
|
1652
|
+
sm = p.get("self_model") or {}
|
|
1653
|
+
bucket = sm.get(kind)
|
|
1654
|
+
if not isinstance(bucket, list):
|
|
1655
|
+
self._json({"ok": False, "error": f"未知桶:{kind}"}, 400)
|
|
1656
|
+
return
|
|
1657
|
+
before = len(bucket)
|
|
1658
|
+
sm[kind] = [x for x in bucket
|
|
1659
|
+
if str(x.get("text") if isinstance(x, dict) else x, "").strip() != text]
|
|
1660
|
+
if len(sm[kind]) == before:
|
|
1661
|
+
self._json({"ok": False, "error": "没找到要删的条目"}, 404)
|
|
1662
|
+
return
|
|
1663
|
+
brain.save_persona(p)
|
|
1662
1664
|
self._json({"ok": True, "removed": True, "self_model": brain.self_model_get()})
|
|
1663
1665
|
return
|
|
1664
1666
|
self._json({"ok": False, "error": f"未知 action: {act}(add/remove)"}, 400)
|
|
@@ -3163,6 +3165,7 @@ def _ollama_pull_model() -> bool:
|
|
|
3163
3165
|
|
|
3164
3166
|
def _ollama_install_async() -> None:
|
|
3165
3167
|
"""后台安装流水线:解压 → 起 serve → 拉模型 → 写 embed 配置 → done。"""
|
|
3168
|
+
global _OLLAMA_INSTALL_RUNNING
|
|
3166
3169
|
try:
|
|
3167
3170
|
zip_path = _ollama_zip_path()
|
|
3168
3171
|
if not zip_path.is_file():
|
|
@@ -3188,6 +3191,10 @@ def _ollama_install_async() -> None:
|
|
|
3188
3191
|
_ollama_state_write("done", percent=100, detail="语义召回已就绪")
|
|
3189
3192
|
except Exception as exc:
|
|
3190
3193
|
_ollama_state_write("error", detail=f"安装失败:{exc}")
|
|
3194
|
+
finally:
|
|
3195
|
+
# LS-081: 安装完成或异常后释放在飞锁
|
|
3196
|
+
_OLLAMA_INSTALL_RUNNING = False
|
|
3197
|
+
_OLLAMA_INSTALL_FLYING.release()
|
|
3191
3198
|
|
|
3192
3199
|
|
|
3193
3200
|
def _api_ollama_status(self, path, data):
|
|
@@ -3214,15 +3221,27 @@ def _api_ollama_download(self, path, data):
|
|
|
3214
3221
|
self._json({"ok": False, "error": "下载任务启动失败,详情见运行日志"}, 500)
|
|
3215
3222
|
|
|
3216
3223
|
|
|
3224
|
+
# LS-081(v5.67):Ollama install 在飞任务保护——重复请求复用状态或返回 409
|
|
3225
|
+
_OLLAMA_INSTALL_FLYING = threading.Lock()
|
|
3226
|
+
_OLLAMA_INSTALL_RUNNING = False
|
|
3227
|
+
|
|
3217
3228
|
def _api_ollama_install(self, path, data):
|
|
3229
|
+
global _OLLAMA_INSTALL_RUNNING
|
|
3218
3230
|
try:
|
|
3219
3231
|
if not _ollama_zip_path().is_file() and _ollama_exe() is None:
|
|
3220
3232
|
self._json({"ok": False, "error": "尚未下载 Ollama,请先点「下载安装」"}, 400)
|
|
3221
3233
|
return
|
|
3234
|
+
# LS-081(v5.67):检查是否已有安装任务在飞,防止多线程写同一安装目录
|
|
3235
|
+
if not _OLLAMA_INSTALL_FLYING.acquire(blocking=False):
|
|
3236
|
+
self._json({"ok": False, "error": "安装任务已在进行中,请等待完成"}, 409)
|
|
3237
|
+
return
|
|
3238
|
+
_OLLAMA_INSTALL_RUNNING = True
|
|
3222
3239
|
threading.Thread(target=_ollama_install_async,
|
|
3223
3240
|
name="ollama-install", daemon=True).start()
|
|
3224
3241
|
self._json({"ok": True, "stage": "extracting"})
|
|
3225
3242
|
except Exception as exc:
|
|
3243
|
+
_OLLAMA_INSTALL_RUNNING = False
|
|
3244
|
+
_OLLAMA_INSTALL_FLYING.release()
|
|
3226
3245
|
self._log_write_failure("ollama install", exc, 500)
|
|
3227
3246
|
self._json({"ok": False, "error": "安装任务启动失败,详情见运行日志"}, 500)
|
|
3228
3247
|
|