oricore 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ ImagePart,
2
3
  NormalizedMessage,
3
4
  ReasoningPart,
4
5
  TextPart,
@@ -154,6 +155,23 @@ export function normalizeMessagesForCompact(
154
155
  };
155
156
  }
156
157
 
158
+ // Filter out image parts from user messages in compact mode
159
+ // Images consume too many tokens and are not needed for summarization
160
+ if (message.role === 'user') {
161
+ if (Array.isArray(message.content)) {
162
+ const filteredContent = message.content.filter(
163
+ (part): part is TextPart => part.type === 'text',
164
+ );
165
+ return {
166
+ ...message,
167
+ content: (filteredContent.length > 0
168
+ ? filteredContent
169
+ : message.content) as Array<TextPart | ImagePart>,
170
+ };
171
+ }
172
+ return message;
173
+ }
174
+
157
175
  return message;
158
176
  })
159
177
  .filter((message) => {