Skip to content

在发给 LLM 的上下文记录中注入时间戳,以增强角色的时间感知能力 | Inject timestamps into the LLM context history to enhance the character's time perception #1570

@LLLLLLwx

Description

@LLLLLLwx

Clear and concise description of the problem

在组装 Prompt 时,将时间戳隐式地加入到角色或用户的发言前。
例如:
[2026-04-04 14:00:00] User: 下午好呀
[2026-04-04 14:00:05] LLM: 下午好!
...(经过了几个小时)...
[2026-04-04 23:30:00] User: 我准备睡觉啦

不然,LLM 会回溯太多的上下文,导致时间错乱。
比如,当前系统时间是下午,如果上文有一句是 “晚上好”。那LLM就会认为现在是下午,问你困不困。很诡异。


When assembling the prompt, timestamps should be implicitly injected before the user's or the character's messages.

For example:

[2026-04-04 14:00:00] User: Good afternoon!
[2026-04-04 14:00:05] LLM: Good afternoon!
... (several hours later) ...
[2026-04-04 23:30:00] User: I'm getting ready for bed.

Otherwise, the LLM tends to backtrack too far into the context, leading to timeline confusion.

For instance, if the current system time is afternoon, but there happens to be a "good evening" in the earlier chat history, the LLM might get confused and ask if you are sleepy during the afternoon. It feels very weird and breaks the immersion.

Suggested solution / Ideas

No response

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions