MCPcopy Create free account
hub / github.com/CodeFox-Repo/codefox / streamChat

Method streamChat

backend/src/chat/chat.service.ts:24–34  ·  view source on GitHub ↗
(
    input: ChatInput,
  )

Source from the content-addressed store, hash-verified

22 * that is what this folds. An unrecognised role is the caller being wrong
23 * about something this function cannot guess, and is refused rather than
24 * silently relabelled.
25 *
26 * ponytail: one guard on the single write path, rather than validation in
27 * each of saveMessage's callers.
28 */
29export function normaliseRole(role: string): MessageRole {
30 const found = Object.values(MessageRole).find(
31 (r) => r.toLowerCase() === String(role).toLowerCase(),
32 );
33 if (!found) {
34 throw new NotFoundException(
35 `Unknown message role "${role}" — expected one of ${Object.values(
36 MessageRole,
37 ).join(', ')}`,

Callers 2

triggerChatStreamMethod · 0.80
chatMethod · 0.80

Calls 1

chatMethod · 0.65

Tested by

no test coverage detected