chore: code refactor

This commit is contained in:
Abhishek Kumar 2026-02-14 13:43:20 +05:30
parent c0cbc65de3
commit c7812bf189
29 changed files with 538 additions and 800 deletions

View file

@ -167,4 +167,4 @@ export function TransferCallToolConfig({
</CardContent>
</Card>
);
}
}

View file

@ -410,7 +410,7 @@ const data = await response.json();`;
</div>
</div>
<div className="flex items-center gap-2">
{!isEndCallTool && (
{!isEndCallTool && !isTransferCallTool && (
<Button
variant="outline"
onClick={() => setShowCodeDialog(true)}
@ -419,34 +419,9 @@ const data = await response.json();`;
View Code
</Button>
)}
<Button onClick={handleSave} disabled={isSaving}>
{isSaving ? (
<>
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
Saving...
</>
) : (
<>
<Save className="w-4 h-4 mr-2" />
Save
</>
)}
</Button>
</div>
</div>
{error && (
<div className="mb-4 p-4 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive">
{error}
</div>
)}
{saveSuccess && (
<div className="mb-4 p-4 bg-green-500/10 border border-green-500/20 rounded-lg text-green-600">
Tool saved successfully!
</div>
)}
{isEndCallTool ? (
<EndCallToolConfig
name={name}
@ -493,6 +468,34 @@ const data = await response.json();`;
onTimeoutMsChange={setTimeoutMs}
/>
)}
{error && (
<div className="mt-4 p-4 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive">
{error}
</div>
)}
{saveSuccess && (
<div className="mt-4 p-4 bg-green-500/10 border border-green-500/20 rounded-lg text-green-600">
Tool saved successfully!
</div>
)}
<div className="flex justify-end mt-6">
<Button onClick={handleSave} disabled={isSaving}>
{isSaving ? (
<>
<Loader2 className="w-4 h-4 mr-2 animate-spin" />
Saving...
</>
) : (
<>
<Save className="w-4 h-4 mr-2" />
Save
</>
)}
</Button>
</div>
</div>
</div>

View file

@ -1,6 +1,6 @@
"use client";
import { Cog, Globe, type LucideIcon, PhoneOff, PhoneForwarded, 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" | "transfer_call" | "native" | "integration";

View file

@ -1,8 +1,9 @@
// This file is auto-generated by @hey-api/openapi-ts
import type { ClientOptions } from './types.gen';
import { type Config, type ClientOptions as DefaultClientOptions, createClient, createConfig } from '@hey-api/client-fetch';
import { type ClientOptions as DefaultClientOptions, type Config, createClient, createConfig } from '@hey-api/client-fetch';
import { createClientConfig } from '../lib/apiClient';
import type { ClientOptions } from './types.gen';
/**
* The `createClientConfig()` function will be called on client initialization
@ -16,4 +17,4 @@ export type CreateClientConfig<T extends DefaultClientOptions = ClientOptions> =
export const client = createClient(createClientConfig(createConfig<ClientOptions>({
baseUrl: 'http://127.0.0.1:8000'
})));
})));

View file

@ -1,3 +1,3 @@
// This file is auto-generated by @hey-api/openapi-ts
export * from './sdk.gen';
export * from './types.gen';
export * from './sdk.gen';

File diff suppressed because one or more lines are too long

View file

@ -882,16 +882,14 @@ export type TransferCallConfig = {
};
/**
* Request model for initiating call transfer using webhook-driven completion
* Request model for initiating a call transfer.
*/
export type TransferCallRequest = {
destination: string;
organization_id: number;
transfer_id: string;
conference_name: string;
timeout?: number | null;
tool_call_id?: string | null;
tool_uuid?: string | null;
original_call_sid?: string | null;
caller_number?: string | null;
};
/**
@ -1611,16 +1609,16 @@ export type InitiateCallTransferApiV1TelephonyCallTransferPostResponses = {
200: unknown;
};
export type HandleTransferCallAnsweredApiV1TelephonyTransferCallHandlerToolCallIdPostData = {
export type CompleteTransferFunctionCallApiV1TelephonyTransferResultTransferIdPostData = {
body?: never;
path: {
tool_call_id: string;
transfer_id: string;
};
query?: never;
url: '/api/v1/telephony/transfer-call-handler/{tool_call_id}';
url: '/api/v1/telephony/transfer-result/{transfer_id}';
};
export type HandleTransferCallAnsweredApiV1TelephonyTransferCallHandlerToolCallIdPostErrors = {
export type CompleteTransferFunctionCallApiV1TelephonyTransferResultTransferIdPostErrors = {
/**
* Not found
*/
@ -1631,59 +1629,9 @@ export type HandleTransferCallAnsweredApiV1TelephonyTransferCallHandlerToolCallI
422: HttpValidationError;
};
export type HandleTransferCallAnsweredApiV1TelephonyTransferCallHandlerToolCallIdPostError = HandleTransferCallAnsweredApiV1TelephonyTransferCallHandlerToolCallIdPostErrors[keyof HandleTransferCallAnsweredApiV1TelephonyTransferCallHandlerToolCallIdPostErrors];
export type CompleteTransferFunctionCallApiV1TelephonyTransferResultTransferIdPostError = CompleteTransferFunctionCallApiV1TelephonyTransferResultTransferIdPostErrors[keyof CompleteTransferFunctionCallApiV1TelephonyTransferResultTransferIdPostErrors];
export type HandleTransferCallAnsweredApiV1TelephonyTransferCallHandlerToolCallIdPostResponses = {
/**
* Successful Response
*/
200: unknown;
};
export type CompleteTransferFunctionCallApiV1TelephonyTransferResultToolCallIdPostData = {
body?: never;
path: {
tool_call_id: string;
};
query?: never;
url: '/api/v1/telephony/transfer-result/{tool_call_id}';
};
export type CompleteTransferFunctionCallApiV1TelephonyTransferResultToolCallIdPostErrors = {
/**
* Not found
*/
404: unknown;
/**
* Validation Error
*/
422: HttpValidationError;
};
export type CompleteTransferFunctionCallApiV1TelephonyTransferResultToolCallIdPostError = CompleteTransferFunctionCallApiV1TelephonyTransferResultToolCallIdPostErrors[keyof CompleteTransferFunctionCallApiV1TelephonyTransferResultToolCallIdPostErrors];
export type CompleteTransferFunctionCallApiV1TelephonyTransferResultToolCallIdPostResponses = {
/**
* Successful Response
*/
200: unknown;
};
export type RegisterTransferToolCallApiV1TelephonyRegisterTransferToolCallPostData = {
body?: never;
path?: never;
query?: never;
url: '/api/v1/telephony/register-transfer-tool-call';
};
export type RegisterTransferToolCallApiV1TelephonyRegisterTransferToolCallPostErrors = {
/**
* Not found
*/
404: unknown;
};
export type RegisterTransferToolCallApiV1TelephonyRegisterTransferToolCallPostResponses = {
export type CompleteTransferFunctionCallApiV1TelephonyTransferResultTransferIdPostResponses = {
/**
* Successful Response
*/
@ -4982,4 +4930,4 @@ export type HealthApiV1HealthGetResponse = HealthApiV1HealthGetResponses[keyof H
export type ClientOptions = {
baseUrl: 'http://127.0.0.1:8000' | (string & {});
};
};