Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

571 B
Raw Blame
export function appendComposerText(input, text) {
  if (input === '/') return text
  const separator = input && !input.endsWith(' ') && !input.endsWith('\n') ? ' ' : ''
  return `${input}${separator}${text}`
}

// A message that did not start goes back to the composer. Text typed while
// Portal worked stays too: the unsent message first, then the newer draft.
export function restoreUnsentDraft(current, unsent) {
  if (!unsent || current === unsent || current.startsWith(`${unsent}\n\n`)) return current
  return current.trim() ? `${unsent}\n\n${current}` : unsent
}