diff --git a/CHANGELOG.md b/CHANGELOG.md index ef191f8dc5..664806cb53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ WeChat original voice can be prepared for playback, native quotes and retained l ### Added +- Every Bot now has a Profile banner at the top of its Profile and its popover. New Bots get a pixel scene picked from their name, which a rename doesn't change; existing Bots get one at the next start. **Change banner** picks one of ten scenes, rerolls the picture, uploads an image cropped to 3:1, or resets to the generated scene. `.botharness/bot.json` records the banner, `.botharness/banner.png` is always written, and Bot Zip export, import and Git import keep it ([#1092](https://github.com/BotHarness/BotHarness/issues/1092)). - After a first real Bot-mode reply, an optional Bind app action opens the existing platform picker and website tutorials; Not now leaves completion intact, and only canonical binding and reception facts determine the result ([#1203](https://github.com/BotHarness/DeepSeekBot/issues/1203)). - After the first real Bot-mode reply, an optional welcome action opens existing Memory files and changes or sends a freeform preference as a normal DM request; skipping stays quiet and only actual files and changes show what was saved ([#1200](https://github.com/BotHarness/DeepSeekBot/issues/1200)). diff --git a/CHANGELOG.zh.md b/CHANGELOG.zh.md index d39ce70e5a..0c885b5747 100644 --- a/CHANGELOG.zh.md +++ b/CHANGELOG.zh.md @@ -17,6 +17,7 @@ ### Added +- 每个 Bot 的资料页和资料小窗顶部都有了横幅。新建的 Bot 会按名字挑一张像素场景,改名不会变;已有的 Bot 在下次启动时补上一张。点 **更换横幅** 可以从十个场景里挑、换一张、上传图片并裁成 3:1,或恢复生成的场景。`.botharness/bot.json` 记录横幅,`.botharness/banner.png` 总会写入,Bot Zip 导出、导入和从 Git 导入都会保留它([#1092](https://github.com/BotHarness/BotHarness/issues/1092))。 - 完成首次真实 Bot 对话后,欢迎消息提供可选的「绑定应用」入口,复用既有平台选择和官网教程;选择「暂时不绑定」保留完成状态,绑定结果与接收状态以真实记录为准([#1203](https://github.com/BotHarness/DeepSeekBot/issues/1203))。 - Bot 模式首次真实回复后,欢迎消息提供可选的记忆体验:查看现有记忆文件与实际变更,或将自由填写的偏好作为普通私聊请求发送;跳过不打扰,也不会把初始模板或回复当作保存成功的证据([#1200](https://github.com/BotHarness/DeepSeekBot/issues/1200))。 diff --git a/docs/assets/pr/1092-profile-banner/README.md b/docs/assets/pr/1092-profile-banner/README.md new file mode 100644 index 0000000000..6d33702d8f --- /dev/null +++ b/docs/assets/pr/1092-profile-banner/README.md @@ -0,0 +1,32 @@ +# #1092 Profile banner + +Captured on a real isolated DSH instance (1440 × 900). Ada had no banner before this change; the Host gave her a name-seeded autumn scene at startup. + +## Profile + +| | zh | en | +| ----- | -------------------------- | -------------------------- | +| Light | ![](profile-zh-light.webp) | ![](profile-en-light.webp) | +| Dark | ![](profile-zh-dark.webp) | ![](profile-en-dark.webp) | + +## Change banner + +| | zh | en | +| ----- | ------------------------- | ------------------------- | +| Light | ![](editor-zh-light.webp) | ![](editor-en-light.webp) | +| Dark | ![](editor-zh-dark.webp) | ![](editor-en-dark.webp) | + +## Upload: 3:1 crop, then the saved image + +| Crop (zh) | Crop (en) | Saved (zh) | +| ----------------------- | ----------------------- | --------------------------- | +| ![](crop-zh-light.webp) | ![](crop-en-light.webp) | ![](uploaded-zh-light.webp) | + +## Popover + +| | zh | en | +| ----- | -------------------------- | -------------------------- | +| Light | ![](popover-zh-light.webp) | ![](popover-en-light.webp) | +| Dark | ![](popover-zh-dark.webp) | ![](popover-en-dark.webp) | + +`guide-05-banner-zh.webp` and `guide-05-banner-en.webp` are the guide images that `docs/share-bot` references as `/guides/share-bot/05-banner-*.webp`; the site copies them into `public/guides/share-bot/` when it next syncs docs. diff --git a/docs/assets/pr/1092-profile-banner/before-profile-zh-light.webp b/docs/assets/pr/1092-profile-banner/before-profile-zh-light.webp new file mode 100644 index 0000000000..dc7eb651ba Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/before-profile-zh-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/crop-en-light.webp b/docs/assets/pr/1092-profile-banner/crop-en-light.webp new file mode 100644 index 0000000000..4ef7ea2e00 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/crop-en-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/crop-zh-light.webp b/docs/assets/pr/1092-profile-banner/crop-zh-light.webp new file mode 100644 index 0000000000..e664929daa Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/crop-zh-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/editor-en-dark.webp b/docs/assets/pr/1092-profile-banner/editor-en-dark.webp new file mode 100644 index 0000000000..7014f32260 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/editor-en-dark.webp differ diff --git a/docs/assets/pr/1092-profile-banner/editor-en-light.webp b/docs/assets/pr/1092-profile-banner/editor-en-light.webp new file mode 100644 index 0000000000..055f5601ea Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/editor-en-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/editor-zh-dark.webp b/docs/assets/pr/1092-profile-banner/editor-zh-dark.webp new file mode 100644 index 0000000000..fcd66df6d4 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/editor-zh-dark.webp differ diff --git a/docs/assets/pr/1092-profile-banner/editor-zh-light.webp b/docs/assets/pr/1092-profile-banner/editor-zh-light.webp new file mode 100644 index 0000000000..7cd84d4f4c Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/editor-zh-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/guide-05-banner-en.webp b/docs/assets/pr/1092-profile-banner/guide-05-banner-en.webp new file mode 100644 index 0000000000..055f5601ea Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/guide-05-banner-en.webp differ diff --git a/docs/assets/pr/1092-profile-banner/guide-05-banner-zh.webp b/docs/assets/pr/1092-profile-banner/guide-05-banner-zh.webp new file mode 100644 index 0000000000..7cd84d4f4c Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/guide-05-banner-zh.webp differ diff --git a/docs/assets/pr/1092-profile-banner/popover-en-dark.webp b/docs/assets/pr/1092-profile-banner/popover-en-dark.webp new file mode 100644 index 0000000000..e06c1a1dec Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/popover-en-dark.webp differ diff --git a/docs/assets/pr/1092-profile-banner/popover-en-light.webp b/docs/assets/pr/1092-profile-banner/popover-en-light.webp new file mode 100644 index 0000000000..105071fbf7 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/popover-en-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/popover-zh-dark.webp b/docs/assets/pr/1092-profile-banner/popover-zh-dark.webp new file mode 100644 index 0000000000..94c17c75fe Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/popover-zh-dark.webp differ diff --git a/docs/assets/pr/1092-profile-banner/popover-zh-light.webp b/docs/assets/pr/1092-profile-banner/popover-zh-light.webp new file mode 100644 index 0000000000..3d8a2d2947 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/popover-zh-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/profile-en-dark.webp b/docs/assets/pr/1092-profile-banner/profile-en-dark.webp new file mode 100644 index 0000000000..056f97dc97 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/profile-en-dark.webp differ diff --git a/docs/assets/pr/1092-profile-banner/profile-en-light.webp b/docs/assets/pr/1092-profile-banner/profile-en-light.webp new file mode 100644 index 0000000000..5db0ec7995 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/profile-en-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/profile-zh-dark.webp b/docs/assets/pr/1092-profile-banner/profile-zh-dark.webp new file mode 100644 index 0000000000..1135d0eaa1 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/profile-zh-dark.webp differ diff --git a/docs/assets/pr/1092-profile-banner/profile-zh-light.webp b/docs/assets/pr/1092-profile-banner/profile-zh-light.webp new file mode 100644 index 0000000000..f97cd96998 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/profile-zh-light.webp differ diff --git a/docs/assets/pr/1092-profile-banner/uploaded-zh-light.webp b/docs/assets/pr/1092-profile-banner/uploaded-zh-light.webp new file mode 100644 index 0000000000..4925fa2004 Binary files /dev/null and b/docs/assets/pr/1092-profile-banner/uploaded-zh-light.webp differ diff --git a/docs/bot-zip.md b/docs/bot-zip.md index f1f6728196..afb7498601 100644 --- a/docs/bot-zip.md +++ b/docs/bot-zip.md @@ -4,12 +4,12 @@ A Bot can be packed into a zip file to send to a friend or colleague, or to move ## What is in the zip -| Included | Never included | -| ------------------------------------------------------------- | ------------------------------------------------------------- | -| The Bot's Memory files, uncommitted changes included | Files ignored by `.gitignore`, symbolic links | -| `.botharness/bot.json` (name, tags, bio) and the avatar image | Sessions, chat history, the Bot Inbox | -| Optional: Git history (every branch, tag and commit) | IM connections, Workspace grants, model settings, credentials | -| | Git remotes, Git config and recovery checkpoints | +| Included | Never included | +| --------------------------------------------------------------------------------------- | ------------------------------------------------------------- | +| The Bot's Memory files, uncommitted changes included | Files ignored by `.gitignore`, symbolic links | +| `.botharness/bot.json` (name, tags, bio), the avatar image and `.botharness/banner.png` | Sessions, chat history, the Bot Inbox | +| Optional: Git history (every branch, tag and commit) | IM connections, Workspace grants, model settings, credentials | +| | Git remotes, Git config and recovery checkpoints | ## Export @@ -18,7 +18,7 @@ A Bot can be packed into a zip file to send to a friend or colleague, or to move ![Share at the top right of the Bot profile](/guides/bot-zip/02-export-section-en.webp) -3. In the export window, choose the files to put in the zip. Everything is ticked by default. Click the arrow in front of a folder to expand it, and untick files or whole folders you don't want to share, or use **Select all** and **Select none**. `.botharness/bot.json` and the avatar are always included and can't be unticked. +3. In the export window, choose the files to put in the zip. Everything is ticked by default. Click the arrow in front of a folder to expand it, and untick files or whole folders you don't want to share, or use **Select all** and **Select none**. `.botharness/bot.json`, the avatar and the banner are always included and can't be unticked. 4. To let the other person see how the Bot's memory changed over time, tick **Include Git history**. 5. Click **Export**. Your browser downloads a zip named after the Bot. @@ -42,7 +42,7 @@ Git history also keeps older content that was deleted or changed. That is why ** Importing creates a new Bot and opens its DM: -- Its name, tags, bio and avatar come from `.botharness/bot.json` in the zip; `roles` in an older zip are imported as tags. Without that file, the zip's file name becomes the Bot's name. +- Its name, tags, bio, avatar and banner come from `.botharness/bot.json` in the zip; `roles` in an older zip are imported as tags. Without that file, the zip's file name becomes the Bot's name. - A zip without Git history gives the new Bot's Memory a single initial commit. - A zip with Git history keeps every branch, tag and commit and checks out the branch the Bot was on when exported; changes that were uncommitted then are still uncommitted. You can see them in [Memory evolution](/docs/channel-sidebar/memory-evolution). diff --git a/docs/bot-zip.zh.md b/docs/bot-zip.zh.md index 17f21513d5..c625a6c74b 100644 --- a/docs/bot-zip.zh.md +++ b/docs/bot-zip.zh.md @@ -4,12 +4,12 @@ Bot 可以打包成一个 zip 文件:发给朋友、同事,或者搬到另 ## zip 里有什么 -| 会放进去 | 不会放进去 | -| ---------------------------------------------------- | ------------------------------------ | -| Bot 的 Memory 文件,包括还没提交的修改 | 被 `.gitignore` 忽略的文件、符号链接 | -| `.botharness/bot.json`(名称、标签、简介)和头像图片 | 会话、聊天记录、Bot 收件箱 | -| 可选:Git 历史(所有分支、标签和提交) | IM 连接、工作区授权、模型设置、凭证 | -| | Git 远程地址、Git 配置和恢复检查点 | +| 会放进去 | 不会放进去 | +| ------------------------------------------------------------------------------- | ------------------------------------ | +| Bot 的 Memory 文件,包括还没提交的修改 | 被 `.gitignore` 忽略的文件、符号链接 | +| `.botharness/bot.json`(名称、标签、简介)、头像图片和 `.botharness/banner.png` | 会话、聊天记录、Bot 收件箱 | +| 可选:Git 历史(所有分支、标签和提交) | IM 连接、工作区授权、模型设置、凭证 | +| | Git 远程地址、Git 配置和恢复检查点 | ## 导出 @@ -18,7 +18,7 @@ Bot 可以打包成一个 zip 文件:发给朋友、同事,或者搬到另 ![Bot 资料页右上角的「分享」](/guides/bot-zip/02-export-section-zh.webp) -3. 在导出窗口里选择要放进 zip 的文件。默认全部勾选;点文件夹前的箭头展开,取消勾选不想分享的文件或整个文件夹,也可以用 **全选** 和 **全不选**。`.botharness/bot.json` 和头像始终包含,不能取消。 +3. 在导出窗口里选择要放进 zip 的文件。默认全部勾选;点文件夹前的箭头展开,取消勾选不想分享的文件或整个文件夹,也可以用 **全选** 和 **全不选**。`.botharness/bot.json`、头像和横幅始终包含,不能取消。 4. 想让对方看到这个 Bot 的记忆是怎么一步步变化的,勾选 **包含 Git 历史**。 5. 点 **导出**,浏览器会下载一个以 Bot 名称命名的 zip。 @@ -42,7 +42,7 @@ Git 历史里也保存着已经删掉或改掉的旧内容。所以只有在全 导入会创建一个新的 Bot,并打开它的私聊: -- 名称、标签、简介和头像来自 zip 里的 `.botharness/bot.json`;旧 zip 里的 `roles` 会作为标签导入。没有这个文件时,名称用 zip 的文件名。 +- 名称、标签、简介、头像和横幅来自 zip 里的 `.botharness/bot.json`;旧 zip 里的 `roles` 会作为标签导入。没有这个文件时,名称用 zip 的文件名。 - zip 不带 Git 历史时,新 Bot 的 Memory 只有一个初始提交。 - zip 带 Git 历史时,所有分支、标签和提交都会保留,并切到导出时所在的分支;导出时还没提交的修改,导入后仍是未提交状态。可以在 [记忆演化](/zh/docs/channel-sidebar/memory-evolution) 里查看。 diff --git a/docs/share-bot.md b/docs/share-bot.md index 25bd139c57..b5fbf1f682 100644 --- a/docs/share-bot.md +++ b/docs/share-bot.md @@ -69,9 +69,9 @@ When listing fails, the Bot Marketplace says why: | This repository was just listed | One repository is fetched at most once per 5 minutes; retry later. | | This repository is blocked or hidden after reports | Open an Issue on the BotHarness repository to contact us. | -## Name, tags, bio and avatar: `.botharness/bot.json` +## Name, tags, bio, avatar and banner: `.botharness/bot.json` -DeepSeekBot writes `.botharness/bot.json` into every Bot's Memory and keeps it up to date: when you create a Bot, and each time you change its name, tags, bio or avatar in **Edit profile**. Bots created before this get the file the next time DeepSeekBot starts. The Marketplace and the installed Bot read it, so they show the same name, tags, bio and avatar as your sidebar. An uploaded avatar image is saved next to it as `.botharness/avatar.png` (or `.jpg`, `.webp`). +DeepSeekBot writes `.botharness/bot.json` into every Bot's Memory and keeps it up to date: when you create a Bot, and each time you change its name, tags, bio or avatar in **Edit profile**. Bots created before this get the file the next time DeepSeekBot starts. The Marketplace and the installed Bot read it, so they show the same name, tags, bio and avatar as your sidebar. An uploaded avatar image is saved next to it as `.botharness/avatar.png` (or `.jpg`, `.webp`). The Profile banner is always saved as `.botharness/banner.png` (1500 × 500), whether it is a generated pixel scene or an uploaded image. You can also edit the file by hand. DeepSeekBot keeps any other keys you add, and keeps your edits until you next change the name, tags, bio or avatar in DeepSeekBot: @@ -80,17 +80,34 @@ You can also edit the file by hand. DeepSeekBot keeps any other keys you add, an "name": "BotPixel", "tags": ["Pixel art", "Avatar design"], "bio": "Turns a one-line description into a pixel avatar.", - "avatar": { "image": "assets/avatar.png" } + "avatar": { "image": "assets/avatar.png" }, + "banner": { "recipe": { "scene": "sea", "seed": 2786543041 } } } ``` -| Field | Meaning | -| -------- | ------------------------------------------------------------------------------------------------------------------ | -| `name` | Name shown in the Marketplace, up to 60 characters. | -| `tags` | Tags, up to 8, each up to 32 characters. Older files that use `roles` are still read as tags. | -| `bio` | A short introduction, up to 160 characters. Without it the Marketplace shows the GitHub repository description. | -| `avatar` | `{ "image": "path in the repository" }` (PNG, JPEG or WebP, at most 128 KiB), or a pixel avatar `{ "recipe": … }`. | +| Field | Meaning | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | Name shown in the Marketplace, up to 60 characters. | +| `tags` | Tags, up to 8, each up to 32 characters. Older files that use `roles` are still read as tags. | +| `bio` | A short introduction, up to 160 characters. Without it the Marketplace shows the GitHub repository description. | +| `avatar` | `{ "image": "path in the repository" }` (PNG, JPEG or WebP, at most 128 KiB), or a pixel avatar `{ "recipe": … }`. | +| `banner` | A generated pixel scene `{ "recipe": { "scene", "seed" } }`, or `{ "image": ".botharness/banner.png" }` (a 3:1 PNG, at most 2 MB). Scenes: `spring`, `summer`, `autumn`, `winter`, `sea`, `mountain`, `desert`, `forest`, `night-sky`, `space`. | Every field is optional. An invalid file is ignored as a whole, and the Marketplace falls back to the repository name and a generated pixel avatar. +## Profile banner + +Every Bot has a banner at the top of its Profile and of the popover you get from the name at the top of a DM. A new Bot gets a pixel scene picked from its name, and renaming the Bot doesn't change it; Bots created before banners existed get one the next time DeepSeekBot starts. + +Hover the banner and click **Change banner** to: + +- pick one of ten scenes: spring, summer, autumn, winter, sea, mountain, desert, forest, night sky or space; +- **Reroll** for another picture of the same scene; +- **Upload** your own image and crop it to 3:1; +- **Reset** to the scene picked from the Bot's current name. + +![Change banner: a preview, Reroll, Upload, Reset and the ten scenes](/guides/share-bot/05-banner-en.webp) + +The banner travels with the Bot: Bot Zip export and import, and installing from GitHub, keep it. + Related: [Memory files](/docs/channel-sidebar/memory-files), [Memory evolution](/docs/channel-sidebar/memory-evolution). diff --git a/docs/share-bot.zh.md b/docs/share-bot.zh.md index 2cbd5f2792..88e91c5a07 100644 --- a/docs/share-bot.zh.md +++ b/docs/share-bot.zh.md @@ -69,9 +69,9 @@ gh repo edit --add-topic botharness-bot | 这个仓库刚刚收录过 | 同一个仓库 5 分钟内只抓取一次,稍后再试。 | | 这个仓库已被屏蔽或因举报隐藏 | 可以在 GitHub 上给 BotHarness 开 Issue 联系我们。 | -## 设置名称、标签、简介和头像:`.botharness/bot.json` +## 设置名称、标签、简介、头像和横幅:`.botharness/bot.json` -DeepSeekBot 会自动在每个 Bot 的 Memory 里生成 `.botharness/bot.json`,并保持更新:创建 Bot 时写入,之后每次在 **编辑资料** 里改名称、标签、简介,或者改头像,都会同步。之前创建的 Bot 会在 DeepSeekBot 下次启动时补上这个文件。市场和安装后的 Bot 都读它,所以显示的名称、标签、简介和头像和你侧栏里的一致。上传的头像图片会存为旁边的 `.botharness/avatar.png`(或 `.jpg`、`.webp`)。 +DeepSeekBot 会自动在每个 Bot 的 Memory 里生成 `.botharness/bot.json`,并保持更新:创建 Bot 时写入,之后每次在 **编辑资料** 里改名称、标签、简介,或者改头像,都会同步。之前创建的 Bot 会在 DeepSeekBot 下次启动时补上这个文件。市场和安装后的 Bot 都读它,所以显示的名称、标签、简介和头像和你侧栏里的一致。上传的头像图片会存为旁边的 `.botharness/avatar.png`(或 `.jpg`、`.webp`)。资料横幅总是存为 `.botharness/banner.png`(1500 × 500),不管是生成的像素场景还是上传的图片。 也可以手动编辑这个文件。你加的其他字段会保留;手动改的内容会一直保留,直到你下次在 DeepSeekBot 里改名称、标签、简介或头像: @@ -80,17 +80,34 @@ DeepSeekBot 会自动在每个 Bot 的 Memory 里生成 `.botharness/bot.json` "name": "BotPixel 像素画师", "tags": ["像素画", "头像设计"], "bio": "把一句话描述画成像素头像。", - "avatar": { "image": "assets/avatar.png" } + "avatar": { "image": "assets/avatar.png" }, + "banner": { "recipe": { "scene": "sea", "seed": 2786543041 } } } ``` -| 字段 | 说明 | -| -------- | --------------------------------------------------------------------------------------------------------------- | -| `name` | 在市场里显示的名称,最多 60 个字。 | -| `tags` | 标签,最多 8 个,每个不超过 32 个字。旧文件里的 `roles` 仍会当作标签读取。 | -| `bio` | 一句话简介,最多 160 个字。没有时市场显示 GitHub 仓库的描述。 | -| `avatar` | 头像:`{ "image": "仓库里的图片路径" }`,PNG、JPEG 或 WebP,最大 128 KiB;或者 `{ "recipe": … }` 像素头像配方。 | +| 字段 | 说明 | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `name` | 在市场里显示的名称,最多 60 个字。 | +| `tags` | 标签,最多 8 个,每个不超过 32 个字。旧文件里的 `roles` 仍会当作标签读取。 | +| `bio` | 一句话简介,最多 160 个字。没有时市场显示 GitHub 仓库的描述。 | +| `avatar` | 头像:`{ "image": "仓库里的图片路径" }`,PNG、JPEG 或 WebP,最大 128 KiB;或者 `{ "recipe": … }` 像素头像配方。 | +| `banner` | 横幅:生成的像素场景 `{ "recipe": { "scene", "seed" } }`,或 `{ "image": ".botharness/banner.png" }`(3:1 的 PNG,最大 2 MB)。场景:`spring`、`summer`、`autumn`、`winter`、`sea`、`mountain`、`desert`、`forest`、`night-sky`、`space`。 | 所有字段都可以省略。文件格式不对时整个文件会被忽略,市场改用仓库名和自动生成的像素头像。 +## 资料横幅 + +每个 Bot 的资料页顶部,以及在私聊顶部点名字弹出的小窗顶部,都有一张横幅。新建的 Bot 会按名字挑一张像素场景,之后改名不会变;横幅上线前创建的 Bot,会在 DeepSeekBot 下次启动时补上一张。 + +鼠标移到横幅上,点 **更换横幅**,可以: + +- 从十个场景里挑一个:春、夏、秋、冬、海、山、沙漠、森林、星空、太空; +- **换一张**:同一个场景换一幅画; +- **上传图片**:上传自己的图片并裁成 3:1; +- **恢复生成**:回到按 Bot 当前名字挑的场景。 + +![更换横幅:预览、换一张、上传图片、恢复生成和十个场景](/guides/share-bot/05-banner-zh.webp) + +横幅跟着 Bot 走:Bot Zip 导出、导入,以及从 GitHub 安装,都会保留它。 + 相关:[记忆文件](/zh/docs/channel-sidebar/memory-files)、[记忆演化](/zh/docs/channel-sidebar/memory-evolution)。 diff --git a/packages/client/package.json b/packages/client/package.json index 3248ce5f09..14f5ceef5e 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -20,6 +20,7 @@ "dependencies": { "@blobatar/react": "^2.7.0", "@botharness/botui-core": "0.3.0", + "@botharness/pixel-banner": "0.1.0", "@botharness/pixel-morph": "0.2.0", "blobatar": "^2.7.0", "driver.js": "1.4.0", diff --git a/packages/client/src/client/actions.ts b/packages/client/src/client/actions.ts index f1899c77b7..d0d16936e6 100644 --- a/packages/client/src/client/actions.ts +++ b/packages/client/src/client/actions.ts @@ -1,3 +1,4 @@ +import type { PixelBannerRecipe } from '@botharness/pixel-banner'; import { onboardingFor } from './onboarding.js'; import type { OnboardingSnapshot, TutorialAction } from '../../../core/src/onboarding/types.js'; import type {} from '@deepseek-ai/dsh-api-session-controller/client'; @@ -90,6 +91,7 @@ import { setGroupAvatar as setGroupAvatarViaBridge, setChannelHumanName, setBotAvatar as setBotAvatarViaBridge, + setBotBanner as setBotBannerViaBridge, updateBotProfile as updateBotProfileViaBridge, setBotAppearance as setBotAppearanceViaBridge, cancelGroupInvitation, @@ -565,6 +567,10 @@ export interface BridgeActions { setHumanNickname(channelId: string, nickname: string | null): Promise; setGroupAvatar(channelId: string, avatar: string | null): Promise; setBotAvatar(channelId: string, avatar: string | null): Promise; + setBotBanner( + channelId: string, + banner: { recipe: PixelBannerRecipe } | { image: string } | null, + ): Promise; updateBotProfile( slug: string, patch: { roles?: string[]; description?: string }, @@ -2265,6 +2271,16 @@ export function createActions( return false; } }, + async setBotBanner(channelId, banner) { + try { + const bot = await setBotBannerViaBridge(call, channelId, banner); + clientStore.upsertBot(bot); + return true; + } catch (error) { + console.warn('botharness: Bot banner update failed', error); + return false; + } + }, async setGroupAvatar(channelId, avatar) { try { const channel = await setGroupAvatarViaBridge(call, channelId, avatar); diff --git a/packages/client/src/client/bot-banner.tsx b/packages/client/src/client/bot-banner.tsx new file mode 100644 index 0000000000..b596ca4f38 --- /dev/null +++ b/packages/client/src/client/bot-banner.tsx @@ -0,0 +1,56 @@ +import type { ReactElement } from 'react'; +import { + BANNER_HEIGHT, + BANNER_WIDTH, + pixelBannerPixels, + seededBannerRecipe, + type PixelBannerRecipe, +} from '@botharness/pixel-banner'; + +import { useMountedResource } from './mounted-resource.js'; +import type { BotBannerView } from './store.js'; + +export function bannerOf(banner: BotBannerView | undefined, name: string): BotBannerView { + return banner ?? { recipe: seededBannerRecipe(name) }; +} + +function BannerCanvas({ + recipe, + className, +}: { + recipe: PixelBannerRecipe; + className: string; +}): ReactElement { + const paint = useMountedResource( + (canvas) => { + const context = canvas.getContext('2d'); + if (context === null) return; + const { data, width, height } = pixelBannerPixels(recipe); + context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0); + }, + [recipe.scene, recipe.seed], + ); + return ( +