MCPcopy Create free account
hub / github.com/chieapp/chie / getFirstSentence

Function getFirstSentence

src/controller/title-generator.ts:64–78  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

62}
63
64function getFirstSentence(content: string) {
65 // Return the first words of last message.
66 const words = content.substring(0, 30).split(' ').slice(0, 5);
67 // Likely a language without spaces in words.
68 if (words.length < 3)
69 return words[0].substring(0, 10);
70 // Join the words but do not exceed 15 characters.
71 let sentence = '';
72 for (const word of words) {
73 sentence += word + ' ';
74 if (sentence.length > 15)
75 break;
76 }
77 return sentence;
78}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected