timecontext

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package timecontext 复刻官方 context/time-context 的纯渲染部分:在准备请求时 采样当前时间、时区,并给出距上一条模型可见消息经过的时长,让模型知道"现在是 什么时候、已经过了多久"。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatElapsed

func FormatElapsed(d time.Duration) string

FormatElapsed 把经过时间格式化为紧凑的整秒单位(d/h/m/s)。

func Render

func Render(now time.Time, loc *time.Location, previous *time.Time) string

Render 生成时钟上下文文本。loc 为 nil 时用 UTC;previous 为 nil 时经过时长 记为 unavailable。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL