X-Git-Url: http://git.giacomolli.uk/onechat/blobdiff_plain/36229ef68a30c5a117599037d79fa1fc708fbfef..4343ca5fb6cc86eb887951f4fe16063bab29a238:/tree.go?ds=sidebyside 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 }