X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/522d7fd117285e4e4ce3ea5ec9b5a1722521b681..7b8d8e8f4b57bd51fd6d0f0d926b821f06b0e1f0:/tree.go diff --git a/tree.go b/tree.go index 69558c5..079969c 100644 --- a/tree.go +++ b/tree.go @@ -55,11 +55,11 @@ func leafSource(message Message) string { return message.Kind + ": " + message.Text } -// freeLeaf returns the leaf of message when its source fits in a node. Such a -// leaf holds the source word for word and needs no model call. +// freeLeaf returns a text-only leaf when its source fits in a node. Images need +// a model description even when their text fits. func freeLeaf(message Message) (Node, bool) { text := leafSource(message) - if len(text) > nodeBytes { + if len(text) > nodeBytes || len(imageFiles(message.Text)) > 0 { return Node{}, false }