File size: 1,016 Bytes
fc93158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import {
  makeWhatsAppDirectiveConfig,
  replyText,
  sessionStorePath,
} from "./reply.directive.directive-behavior.e2e-harness.js";
import { getReplyFromConfig } from "./reply.js";

export async function runModelDirectiveText(
  home: string,
  body: string,
  options: {
    defaults?: Record<string, unknown>;
    extra?: Record<string, unknown>;
    includeSessionStore?: boolean;
  } = {},
): Promise<string | undefined> {
  const res = await getReplyFromConfig(
    { Body: body, From: "+1222", To: "+1222", CommandAuthorized: true },
    {},
    makeWhatsAppDirectiveConfig(
      home,
      {
        model: { primary: "anthropic/claude-opus-4-5" },
        models: {
          "anthropic/claude-opus-4-5": {},
          "openai/gpt-4.1-mini": {},
        },
        ...options.defaults,
      },
      {
        ...(options.includeSessionStore === false
          ? {}
          : { session: { store: sessionStorePath(home) } }),
        ...options.extra,
      },
    ),
  );
  return replyText(res);
}