Skip to content

Commit

Permalink
fix: filter model memory context message
Browse files Browse the repository at this point in the history
  • Loading branch information
pionxzh committed Mar 30, 2024
1 parent dbb7022 commit a99c9f1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/api.ts
Expand Up @@ -137,6 +137,9 @@ export interface ConversationNodeMessage {
// multi-modal input
content_type: 'multimodal_text'
parts: Array<MultiModalInputImage | string>
} | {
content_type: 'model_editable_context'
model_set_context: string
}
create_time?: number
update_time?: number
Expand Down Expand Up @@ -458,7 +461,12 @@ function extractConversationResult(conversationMapping: Record<string, Conversat
break // Stop at root message.
}

if (node.message?.author.role !== 'system') { // Skip system messages
if (
// Skip system messages
node.message?.author.role !== 'system'
// Skip model memory context
&& node.message?.content.content_type !== 'model_editable_context'
) {
result.unshift(node)
}

Expand Down

0 comments on commit a99c9f1

Please sign in to comment.