@lssm/lib.content-gen 0.0.0-canary-20251207123819 → 0.0.0-canary-20251207143345
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 +1 @@
|
|
|
1
|
-
var e=class{llm;model;constructor(e){this.llm=e?.llm,this.model=e?.model}async generate(e){if(this.llm){let t=await this.generateWithLlm(e);if(t.length)return t}return this.generateFallback(e)}async generateWithLlm(e){let t=(await this.llm.chat([{role:`system`,content:[{type:`text`,text:`Create JSON array of social posts for twitter/linkedin/threads with body, hashtags, cta.`}]},{role:`user`,content:[{type:`text`,text:JSON.stringify(e)}]}],{responseFormat:`json`,model:this.model})).message.content.find(e=>`text`in e);return!t||!(`text`in t)?[]:JSON.parse(t.text)}generateFallback(e){let t=this.buildHashtags(e);return[{channel:`linkedin`,body:`${e.title}: ${e.summary}\n${e.problems[0]} → ${e.solutions[0]}`,hashtags:t,cta:e.callToAction??`Book a 15-min run-through`},{channel:`twitter`,body:`${e.solutions[0]} in <60s. ${e.solutions[1]??``}`.trim(),hashtags:t.slice(0,3),cta:`→ contractspec.
|
|
1
|
+
var e=class{llm;model;constructor(e){this.llm=e?.llm,this.model=e?.model}async generate(e){if(this.llm){let t=await this.generateWithLlm(e);if(t.length)return t}return this.generateFallback(e)}async generateWithLlm(e){let t=(await this.llm.chat([{role:`system`,content:[{type:`text`,text:`Create JSON array of social posts for twitter/linkedin/threads with body, hashtags, cta.`}]},{role:`user`,content:[{type:`text`,text:JSON.stringify(e)}]}],{responseFormat:`json`,model:this.model})).message.content.find(e=>`text`in e);return!t||!(`text`in t)?[]:JSON.parse(t.text)}generateFallback(e){let t=this.buildHashtags(e);return[{channel:`linkedin`,body:`${e.title}: ${e.summary}\n${e.problems[0]} → ${e.solutions[0]}`,hashtags:t,cta:e.callToAction??`Book a 15-min run-through`},{channel:`twitter`,body:`${e.solutions[0]} in <60s. ${e.solutions[1]??``}`.trim(),hashtags:t.slice(0,3),cta:`→ contractspec.lssm.tech/sandbox`},{channel:`threads`,body:`Ops + policy can move fast. ${e.title} automates guardrails so teams ship daily.`,hashtags:t.slice(1,4)}]}buildHashtags(e){let n=[e.audience.industry?`#${t(e.audience.industry)}`:`#operations`,`#automation`,`#aiops`,`#compliance`];return[...new Set(n.map(e=>e.replace(/\s+/g,``)))].slice(0,5)}};function t(e){return e.split(/\s|-/).filter(Boolean).map(e=>e[0]?.toUpperCase()+e.slice(1)).join(``)}export{e as SocialPostGenerator};
|