Skip to content

Commit aa7e5c5

Browse files
authored
feat: add conversations (#3235)
1 parent 622b5af commit aa7e5c5

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

packages/agent/src/server/agent-server.configure-environment.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@ describe("AgentServer.configureEnvironment", () => {
144144
expect(env.anthropicBaseUrl).toBe("https://gateway.us.posthog.com/signals");
145145
});
146146

147+
it.each([{ isInternal: true }, { isInternal: false }] as const)(
148+
"tags as conversations when origin_product is 'support_reply' (isInternal=$isInternal)",
149+
({ isInternal }) => {
150+
const env = buildServer("background").configureEnvironment({
151+
isInternal,
152+
originProduct: "support_reply",
153+
});
154+
155+
expect(env.anthropicBaseUrl).toBe(
156+
"https://gateway.us.posthog.com/conversations",
157+
);
158+
expect(env.openaiBaseUrl).toBe(
159+
"https://gateway.us.posthog.com/conversations/v1",
160+
);
161+
},
162+
);
163+
147164
it("forwards task metadata as anthropicCustomHeaders", () => {
148165
const env = buildServer("background").configureEnvironment({
149166
isInternal: true,

packages/agent/src/utils/gateway.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ describe("resolveGatewayProduct", () => {
4949
originProduct: "posthog_ai",
5050
expected: "posthog_ai",
5151
},
52+
{
53+
isInternal: false,
54+
originProduct: "support_reply",
55+
expected: "conversations",
56+
},
57+
{
58+
isInternal: true,
59+
originProduct: "support_reply",
60+
expected: "conversations",
61+
},
5262
] as const)(
5363
"isInternal=$isInternal originProduct=$originProduct -> $expected",
5464
({ isInternal, originProduct, expected }) => {

packages/agent/src/utils/gateway.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ export type GatewayProduct =
33
| "background_agents"
44
| "signals"
55
| "slack_app"
6-
| "posthog_ai";
6+
| "posthog_ai"
7+
| "conversations";
78

89
export function resolveGatewayProduct({
910
isInternal,
@@ -21,6 +22,9 @@ export function resolveGatewayProduct({
2122
if (originProduct === "signal_report" || originProduct === "signals_scout") {
2223
return "signals";
2324
}
25+
if (originProduct === "support_reply") {
26+
return "conversations";
27+
}
2428
if (isInternal) {
2529
return "background_agents";
2630
}

0 commit comments

Comments
 (0)