Files
calendar/packages/trpc/server/routers/viewer/aiVoiceAgent/update.handler.ts
T
Udit TakkarandGitHub 5c70060992 feat: voice and language support in cal.ai (#23865)
* feat: lang support

* fix: type errors

* feat: select voice agent

* refactor: address feedback

* refactor: address feedback

* refactor: missing import

* fix: types
2025-09-16 20:15:11 +05:30

31 lines
1001 B
TypeScript

import { createDefaultAIPhoneServiceProvider } from "@calcom/features/calAIPhone";
import type { RetellLLMGeneralTools } from "@calcom/features/calAIPhone/providers/retellAI/types";
import type { TrpcSessionUser } from "../../../types";
import type { TUpdateInputSchema } from "./update.schema";
type UpdateHandlerOptions = {
ctx: {
user: NonNullable<TrpcSessionUser>;
};
input: TUpdateInputSchema;
};
export const updateHandler = async ({ ctx, input }: UpdateHandlerOptions) => {
const { id, teamId, name, enabled, ...retellUpdates } = input;
const aiService = createDefaultAIPhoneServiceProvider();
return await aiService.updateAgentConfiguration({
id,
userId: ctx.user.id,
teamId,
name,
generalPrompt: retellUpdates.generalPrompt ?? undefined,
beginMessage: retellUpdates.beginMessage ?? undefined,
generalTools: retellUpdates.generalTools as RetellLLMGeneralTools,
voiceId: retellUpdates.voiceId,
language: retellUpdates.language,
});
};