Documentation
¶
Overview ¶
Package affinity 实现 agent 本地的渠道缓存粘性:把 (用户, API token, 真实模型) 上次发生 缓存活动的上游 channel 记下来,供 plan 阶段优先选用。叶子包,只依赖 state(取 ChannelSource)+ settings + utils,不反向 import plan/publish/exec。
Index ¶
Constants ¶
View Source
const ( StatusHit = "hit" StatusFallback = "fallback" StatusNone = "none" )
AffinityStatus values reported in usage logs.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigReader ¶
type ConfigReader interface {
Settings() settings.AgentSettings
}
ConfigReader 读当前同步配置快照。由 app.AgentCache(cache.Store)结构化满足, affinity 借此读 AffinityEnabled / AffinityTTLSec 而不 import app(避免成环)。
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine 是注入到 plan/publish/exec 的门面,组合 Store + Policy + ConfigReader。
type Entry ¶
type Entry struct {
Source state.ChannelSource
SourceID uint
ExpiresAt time.Time
}
Entry 粘性记录值。带 Source 是因为 private/admin 的 ID 是两套空间, 重排时用 (Source, SourceID) 精确匹配候选,避免串号。
Click to show internal directories.
Click to hide internal directories.