mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-11-06 09:17:31 +00:00
refactor: 全面改名为 HologramAgent + 提示词技术内容下沉到 skill/工具描述 + 修 21 处乱码
## ① 全面改名 HomeAgent → HologramAgent
仓库已改名,但代码与文档里仍有大量旧名。本次按"用户能看到的优先"全量替换:
- 用户可见:登录页标题/页脚、默认人格第一句、CLI 状态输出、启动日志、
plugin_install 的工具描述、AI 图片插件的 User-Agent
- 文档与脚本:README、assets/docs、docs/zh、deploy/*.sh、.github/workflows
- 鸿蒙工程:cmd/ohos/HomeAgent → cmd/ohos/HologramAgent(git mv)
目录内的 module/app 描述同步;**证书路径原样保留**
(default_HomeAgent_xxx.cer/p7b/p12 是签名材料的实际文件名,改了会找不到证书)
- 插件元数据:plugin.json 的 author
★ 必须保持原样的两处(改了会坏):
· legacySeededPromptSignature = "你是 HomeAgent 的看板娘「小宅」…"
—— 那是识别历史播种人格卡的**原文锚点**,改了就识别不出旧数据
· 公开 SDK 的 ProxyAuthHomeAgent = "homeagent"
—— 那是 SDK 契约里的值,属独立仓库,本仓不改
## ② 修 21 处乱码(U+FFFD)
这些是历史编辑留下的编码破坏,全在注释里,例如:
「赌注重下���遍」→「赌注重下一遍」
「「不��滤」」 →「「不过滤」」
「**待��退场**」→「**待退场**」
★ 保留 providers/chineseclip/tokenizer.go 里的 2 处:那是**故意**用
U+FFFD 演示"非法 UTF-8 字节被归一成 U+FFFD",不是乱码。
## ③ 提示词技术内容下沉(用户:技术性内容应该收敛到 skill 与 -help 中)
实测系统提示词 2309 字,其中两段几乎全是**模型无法据以行动的实现细节**:
【工具执行顺序】1272 字(ParallelSafe 声明、批内降级、batchRunnable 判据…)
【三层记忆】 1069 字(L1/L2/L3 编号、消费式删除、向量空间、指纹…)
收敛后 **2309 → 1723 字(-25%)**,保留的全是"模型据此做什么不同的事":
工具顺序:默认并行 / 不要依赖先后 / 同通道保序 / 写类工具可能串行
三层记忆:时序里能看最近 / doc_query 把历史事件按原始时间戳插回时序 /
关系用 memory_recall / 成文知识用 knowledge_search
判断口径写进判据:新加一段提示词前先问"模型会据此做什么不同的事",
答不上来就该进 skill 或工具描述。
## 判据
prompt_memory_test.go 新增 2 条:
- TestSystemPromptHasNoImplementationJargon
黑名单:ParallelSafe / batchRunnable / 消费式 / DenseCosine / fingerprint /
向量空间 / 批内降级 / 自激
- TestSystemPromptStaysCompact:上限 2000 字(当前 1723)
变异:把 "ParallelSafe 声明、批内降级" 加回工具顺序段 ⇒ 第一条立刻红。
## 验证
- go build ./... / go vet ./... 干净
- go test ./... -count=1:58 包 0 失败
- make check-client-versions:客户端与内核版本一致
This commit is contained in:
@ -185,7 +185,7 @@ async function adoptSlSession(url) {
|
||||
}
|
||||
|
||||
// 带 Electron cookie jar 的 fetch(跟随外部网关 302 → login 域 → 回跳,最多 6 跳),
|
||||
// 使 POST /api/v1/login 真正触达内层 HomeAgent 并取回 homeagent_session。
|
||||
// 使 POST /api/v1/login 真正触达内层 HologramAgent 并取回 homeagent_session。
|
||||
async function sessionFetch(initUrl, opts) {
|
||||
const { session } = require("electron");
|
||||
let url = initUrl;
|
||||
@ -430,7 +430,7 @@ function createWindow(show = true) {
|
||||
height: 860,
|
||||
minWidth: 900,
|
||||
minHeight: 600,
|
||||
title: "HomeAgent",
|
||||
title: "HologramAgent",
|
||||
frame: false,
|
||||
show: false, // 一律先不显示,由 ready-to-show 决定
|
||||
icon: path.join(__dirname, "icon.ico"),
|
||||
@ -806,7 +806,7 @@ ipcMain.handle("webui:openLogin", (_, { url, username, password }) => {
|
||||
parent: mainWindow,
|
||||
modal: true,
|
||||
autoHideMenuBar: true,
|
||||
title: "HomeAgent - 网关联机登录",
|
||||
title: "HologramAgent - 网关联机登录",
|
||||
webPreferences: { contextIsolation: true, nodeIntegration: false },
|
||||
});
|
||||
const u = encodeURIComponent(username || "");
|
||||
@ -1456,7 +1456,7 @@ async function connectDeviceBridgeOnce(cfg) {
|
||||
op: "hello",
|
||||
device: {
|
||||
device_id: deviceBridgeId,
|
||||
name: "HomeAgent GUI",
|
||||
name: "HologramAgent GUI",
|
||||
kind: "computer",
|
||||
authorized: authorized,
|
||||
caps: [
|
||||
@ -1986,8 +1986,8 @@ function executeHomeagentCmd(capability, reqId) {
|
||||
const h = Math.min(parseInt(area.height || 600, 10) - 40, 560);
|
||||
const html = /<\/?[a-z][\s\S]*>/i.test(raw)
|
||||
? raw
|
||||
: "<div style='font-family:sans-serif;display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;padding:24px;box-sizing:border-box'><h1 style='margin:0 0 16px;color:#ff7fac'>HomeAgent</h1><p style='font-size:16px;line-height:1.6;white-space:pre-wrap;word-break:break-all'>" +
|
||||
String(raw || "HomeAgent 远程屏幕提示").replace(/</g, "<") +
|
||||
: "<div style='font-family:sans-serif;display:flex;flex-direction:column;justify-content:center;align-items:center;height:100%;padding:24px;box-sizing:border-box'><h1 style='margin:0 0 16px;color:#ff7fac'>HologramAgent</h1><p style='font-size:16px;line-height:1.6;white-space:pre-wrap;word-break:break-all'>" +
|
||||
String(raw || "HologramAgent 远程屏幕提示").replace(/</g, "<") +
|
||||
"</p></div>";
|
||||
try {
|
||||
if (screensueWin && !screensueWin.isDestroyed()) screensueWin.destroy();
|
||||
@ -1999,7 +1999,7 @@ function executeHomeagentCmd(capability, reqId) {
|
||||
alwaysOnTop: true,
|
||||
frame: false,
|
||||
resizable: true,
|
||||
title: "HomeAgent · screensue",
|
||||
title: "HologramAgent · screensue",
|
||||
webPreferences: { nodeIntegration: false, contextIsolation: true },
|
||||
});
|
||||
screensueWin.setAlwaysOnTop(true, "screen-saver");
|
||||
@ -3223,7 +3223,7 @@ async function setDeviceAuthorized(authorized) {
|
||||
op: "hello",
|
||||
device: {
|
||||
device_id: deviceBridgeId,
|
||||
name: "HomeAgent GUI",
|
||||
name: "HologramAgent GUI",
|
||||
kind: "computer",
|
||||
authorized: !!authorized,
|
||||
caps: [
|
||||
@ -3291,7 +3291,7 @@ function buildTrayMenuTemplate() {
|
||||
const electron = require("electron");
|
||||
const TMenu = electron.Menu;
|
||||
const tpl = [];
|
||||
tpl.push({ label: "HomeAgent", enabled: true });
|
||||
tpl.push({ label: "HologramAgent", enabled: true });
|
||||
tpl.push({ type: "separator" });
|
||||
// 远程连接状态(缓存避免每次读文件)
|
||||
const connLabel = trayConnCache.connLabel || "未连接";
|
||||
@ -3404,7 +3404,7 @@ function initTray() {
|
||||
img = nImg.createEmpty();
|
||||
}
|
||||
tray = new Tray(img);
|
||||
tray.setToolTip("HomeAgent - 个人智能管家");
|
||||
tray.setToolTip("HologramAgent - 个人智能管家");
|
||||
rebuildTrayMenu();
|
||||
tray.on("double-click", () => showMainWindow());
|
||||
console.log("[tray] READY: " + (tray ? "tray-created" : "null"));
|
||||
@ -3525,7 +3525,7 @@ app.whenReady().then(async () => {
|
||||
// 「启动时不显示主窗口,驻留托盘后台运行」,但主进程从来没读过它 ——
|
||||
// whenReady 无条件 createWindow(),于是必然弹窗。
|
||||
//
|
||||
// 实测(本机,prefs.silentStart=true):窗口标题 HomeAgent 照样出现。
|
||||
// 实测(本机,prefs.silentStart=true):窗口标题 HologramAgent 照样出现。
|
||||
//
|
||||
// 与 applyAutoLaunch 里的 openAsHidden 是两回事:那个是告诉 OS「开机自启
|
||||
// 时如何启动」(仅 Windows/macOS 生效),这里是本进程自己决定要不要显示,
|
||||
@ -3605,7 +3605,7 @@ let notifSeq = 0;
|
||||
ipcMain.handle("notify:show", (_, payload) => {
|
||||
try {
|
||||
const p = payload || {};
|
||||
const title = String(p.title || "HomeAgent");
|
||||
const title = String(p.title || "HologramAgent");
|
||||
const body = String(p.body || "");
|
||||
if (!body) return { ok: false, error: "empty body" };
|
||||
if (!Notification.isSupported()) return { ok: false, error: "unsupported" };
|
||||
@ -3721,10 +3721,10 @@ function saveGuiPrefs(p) {
|
||||
}
|
||||
|
||||
// Electron LoginItem 写入的注册表项名是「electron.app.<exe 名>」。
|
||||
// 产物改名过(HomeAgent.exe → homeagent-gui.exe)就会多出一条旧项,
|
||||
// 产物改名过(HologramAgent.exe → homeagent-gui.exe)就会多出一条旧项,
|
||||
// 且 setLoginItemSettings 不会清理它们 ⇒ 开机启动两次同一个 exe。
|
||||
// 实测本机 Run 键里确实同时存在:
|
||||
// electron.app.HomeAgent = "E:\program\homeagent\...\homeagent-gui.exe"
|
||||
// electron.app.HologramAgent = "E:\program\homeagent\...\homeagent-gui.exe"
|
||||
// electron.app.homeagent-gui = E:\program\homeagent\...\homeagent-gui.exe
|
||||
// 两条指向同一 exe,所以表面看是两个自启动,实际是同一份的重复。
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user