mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-25 08:48:13 +02:00
add call transfer skeleton
This commit is contained in:
parent
e8005042e2
commit
c990af2a16
8 changed files with 450 additions and 25 deletions
|
|
@ -1,9 +1,9 @@
|
|||
"use client";
|
||||
|
||||
import { Cog, Globe, type LucideIcon,PhoneOff, Puzzle } from "lucide-react";
|
||||
import { Cog, Globe, type LucideIcon, PhoneForwarded, PhoneOff, Puzzle } from "lucide-react";
|
||||
import { type ReactNode } from "react";
|
||||
|
||||
export type ToolCategory = "http_api" | "end_call" | "native" | "integration";
|
||||
export type ToolCategory = "http_api" | "end_call" | "transfer_call" | "native" | "integration";
|
||||
|
||||
export type EndCallMessageType = "none" | "custom";
|
||||
|
||||
|
|
@ -42,6 +42,18 @@ export const TOOL_CATEGORIES: ToolCategoryConfig[] = [
|
|||
description: "End the call when either user asks to disconnect the call, or when you believe its time to end the conversation",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "transfer_call",
|
||||
label: "Transfer Call",
|
||||
description: "Transfer the call to another phone number",
|
||||
icon: PhoneForwarded,
|
||||
iconName: "phone-forwarded",
|
||||
iconColor: "#10B981",
|
||||
autoFill: {
|
||||
name: "Transfer Call",
|
||||
description: "Transfer the call to another phone number when the user requests to speak with a human or when escalation is needed",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "native",
|
||||
label: "Native (Coming Soon)",
|
||||
|
|
@ -85,6 +97,8 @@ export function getToolTypeLabel(category: string): string {
|
|||
switch (category) {
|
||||
case "end_call":
|
||||
return "End Call Tool";
|
||||
case "transfer_call":
|
||||
return "Transfer Call Tool";
|
||||
case "http_api":
|
||||
return "HTTP API Tool";
|
||||
case "native":
|
||||
|
|
@ -107,6 +121,17 @@ export const DEFAULT_END_CALL_CONFIG: EndCallConfig = {
|
|||
customMessage: "",
|
||||
};
|
||||
|
||||
// Transfer Call tool specific configuration
|
||||
export interface TransferCallConfig {
|
||||
transferNumber: string;
|
||||
transferMessage?: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_TRANSFER_CALL_CONFIG: TransferCallConfig = {
|
||||
transferNumber: "",
|
||||
transferMessage: "",
|
||||
};
|
||||
|
||||
// Tool definition types for different categories
|
||||
export interface HttpApiToolDefinition {
|
||||
schema_version: number;
|
||||
|
|
@ -132,7 +157,13 @@ export interface EndCallToolDefinition {
|
|||
config: EndCallConfig;
|
||||
}
|
||||
|
||||
export type ToolDefinition = HttpApiToolDefinition | EndCallToolDefinition;
|
||||
export interface TransferCallToolDefinition {
|
||||
schema_version: number;
|
||||
type: "transfer_call";
|
||||
config: TransferCallConfig;
|
||||
}
|
||||
|
||||
export type ToolDefinition = HttpApiToolDefinition | EndCallToolDefinition | TransferCallToolDefinition;
|
||||
|
||||
export function createEndCallDefinition(config: EndCallConfig): EndCallToolDefinition {
|
||||
return {
|
||||
|
|
@ -142,6 +173,14 @@ export function createEndCallDefinition(config: EndCallConfig): EndCallToolDefin
|
|||
};
|
||||
}
|
||||
|
||||
export function createTransferCallDefinition(config: TransferCallConfig): TransferCallToolDefinition {
|
||||
return {
|
||||
schema_version: 1,
|
||||
type: "transfer_call",
|
||||
config,
|
||||
};
|
||||
}
|
||||
|
||||
export function createHttpApiDefinition(): HttpApiToolDefinition {
|
||||
return {
|
||||
schema_version: 1,
|
||||
|
|
@ -157,6 +196,8 @@ export function createToolDefinition(category: ToolCategory): ToolDefinition {
|
|||
switch (category) {
|
||||
case "end_call":
|
||||
return createEndCallDefinition(DEFAULT_END_CALL_CONFIG);
|
||||
case "transfer_call":
|
||||
return createTransferCallDefinition(DEFAULT_TRANSFER_CALL_CONFIG);
|
||||
case "http_api":
|
||||
default:
|
||||
return createHttpApiDefinition();
|
||||
|
|
|
|||
|
|
@ -227,6 +227,8 @@ export default function ToolsPage() {
|
|||
return <Badge variant="default">HTTP API</Badge>;
|
||||
case "end_call":
|
||||
return <Badge variant="destructive">End Call</Badge>;
|
||||
case "transfer_call":
|
||||
return <Badge className="bg-emerald-500">Transfer Call</Badge>;
|
||||
case "native":
|
||||
return <Badge variant="secondary">Native</Badge>;
|
||||
case "integration":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue