MCPcopy Create free account
hub / github.com/Xyntopia/taskyon / createTaskChatMessages

Function createTaskChatMessages

src/modules/chat.ts:497–520  ·  view source on GitHub ↗
(
  templates: Record<string, string>,
  variables: Record<string, string>
)

Source from the content-addressed store, hash-verified

495}
496
497function createTaskChatMessages(
498 templates: Record<string, string>,
499 variables: Record<string, string>
500) {
501 // TODO: can we do this as a javascript tag function? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
502 const messages: Record<string, string> = {};
503
504 // Iterate over each template
505 for (const [templateKey, templateValue] of Object.entries(templates)) {
506 let content = templateValue;
507
508 // Replace placeholders in the template with values from variables
509 for (const [variableKey, variableValue] of Object.entries(variables)) {
510 content = content.replace(
511 new RegExp(`{${variableKey}}`, 'g'),
512 variableValue
513 );
514 }
515
516 messages[templateKey] = content;
517 }
518
519 return messages;
520}
521
522export function prepareTasksForInference(
523 task: LLMTask,

Callers 1

prepareTasksForInferenceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected