MCPcopy Create free account
hub / github.com/echoVic/blade-code / filterByPriority

Method filterByPriority

src/context/processors/ContextFilter.ts:129–138  ·  view source on GitHub ↗

* 按优先级过滤消息

(messages: ContextMessage[], minPriority: number)

Source from the content-addressed store, hash-verified

127 * 按优先级过滤消息
128 */
129 private filterByPriority(messages: ContextMessage[], minPriority: number): ContextMessage[] {
130 return messages.filter(msg => {
131 // 系统消息始终保留
132 if (msg.role === 'system') return true;
133
134 // 计算消息优先级
135 const priority = this.calculateMessagePriority(msg);
136 return priority >= minPriority;
137 });
138 }
139
140 /**
141 * 计算消息优先级

Callers 1

filterConversationMethod · 0.95

Calls 2

filterMethod · 0.45

Tested by

no test coverage detected