Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

493 B
Raw Blame
// Hermes can stream its reasoning again as one quoted "πŸ’­" block that ends with the reply already streamed.

/** True when `chunk` replays the reasoning before `streamed`, the reply text so far. */
export function isHermesReasoningReplay(chunk: string, streamed: string): boolean {
  const reply = streamed.trim();
  const replay = chunk.trim();
  return reply !== "" && /^(?:> |-# )?πŸ’­/.test(replay) && replay.endsWith(reply)
    && /\n\n[ \t]*$/.test(replay.slice(0, -reply.length));
}