# AI Persona Editor 的一个小错误：

**URL:** https://meta.discourse.org/t/small-bug-in-ai-persona-editor-optional-fields-values-persist-after-saving/373176
**Category:** Bug
**Tags:** ai
**Created:** [2025年七月7日 12:50 UTC](https://meta.discourse.org/t/small-bug-in-ai-persona-editor-optional-fields-values-persist-after-saving/373176 "2025-07-07T12:50:16Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [2025年七月7日 12:50 UTC](https://meta.discourse.org/t/small-bug-in-ai-persona-editor-optional-fields-values-persist-after-saving/373176/1 "2025-07-07T12:50:16Z")

</div>

Discourse 版本：3.5.0.beta8-dev

重现步骤：

1. 创建一个新的或编辑一个现有的 AI 角色。
2. 在以下字段中输入任何值：
  - 最大上下文帖子数（可选）
  - 温度（可选）
  - Top P（可选）

3. 保存角色。
4. 删除这些值，使输入字段变为空。
5. 点击保存。

这些值会重新出现，但字段应该保持为空，因为这些是可选字段。

屏幕录像如下：

![CleanShot 2025-07-07 at 14.48.48](https://global.discourse-cdn.com/meta/original/4X/0/5/4/054542457edf2851b78f956102a64b117e168adc.gif)

([GIF uploaded to CleanShot Cloud](https://cln.sh/G7my4XXN))

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2025年七月8日 02:25 UTC](https://meta.discourse.org/t/small-bug-in-ai-persona-editor-optional-fields-values-persist-after-saving/373176/2 "2025-07-08T02:25:51Z")

</div>

抓得好，我们会看看的。

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2025年七月8日 15:42 UTC](https://meta.discourse.org/t/small-bug-in-ai-persona-editor-optional-fields-values-persist-after-saving/373176/4 "2025-07-08T15:42:50Z")

</div>

感谢您的报告。这应该可以解决问题：

> <https://github.com/discourse/discourse/pull/33520>
>
> At the moment emptying a input-text is making it \`undefined\` instead of \`null\`. …It's generally not a big deal but can be harder to work with.
> 
> There's also the very specific case of \`JSON.stringify(data)\` which will remove keys if the value is undefined.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2025年七月11日 15:43 UTC](https://meta.discourse.org/t/small-bug-in-ai-persona-editor-optional-fields-values-persist-after-saving/373176/5 "2025-07-11T15:43:25Z")

</div>

此主题在最后回复后 3 天自动关闭。不再允许新的回复。
