Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,23 @@ describe("AgentServer.configureEnvironment", () => {
expect(env.anthropicBaseUrl).toBe("https://gateway.us.posthog.com/signals");
});

it.each([{ isInternal: true }, { isInternal: false }] as const)(
"tags as conversations when origin_product is 'support_reply' (isInternal=$isInternal)",
({ isInternal }) => {
const env = buildServer("background").configureEnvironment({
isInternal,
originProduct: "support_reply",
});

expect(env.anthropicBaseUrl).toBe(
"https://gateway.us.posthog.com/conversations",
);
expect(env.openaiBaseUrl).toBe(
"https://gateway.us.posthog.com/conversations/v1",
);
},
);

it("forwards task metadata as anthropicCustomHeaders", () => {
const env = buildServer("background").configureEnvironment({
isInternal: true,
Expand Down
10 changes: 10 additions & 0 deletions packages/agent/src/utils/gateway.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ describe("resolveGatewayProduct", () => {
originProduct: "posthog_ai",
expected: "posthog_ai",
},
{
isInternal: false,
originProduct: "support_reply",
expected: "conversations",
},
{
isInternal: true,
originProduct: "support_reply",
expected: "conversations",
},
] as const)(
"isInternal=$isInternal originProduct=$originProduct -> $expected",
({ isInternal, originProduct, expected }) => {
Expand Down
6 changes: 5 additions & 1 deletion packages/agent/src/utils/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export type GatewayProduct =
| "background_agents"
| "signals"
| "slack_app"
| "posthog_ai";
| "posthog_ai"
| "conversations";

export function resolveGatewayProduct({
isInternal,
Expand All @@ -21,6 +22,9 @@ export function resolveGatewayProduct({
if (originProduct === "signal_report" || originProduct === "signals_scout") {
return "signals";
}
if (originProduct === "support_reply") {
return "conversations";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either support_reply or conversations – whatever works better for you, but I'd not change the value here.

}
if (isInternal) {
return "background_agents";
}
Expand Down
Loading