mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-28 08:49:42 +02:00
feat: allow recordings in tool transitions
This commit is contained in:
parent
65c76ca7ff
commit
74dbafb055
38 changed files with 1555 additions and 692 deletions
|
|
@ -6,9 +6,10 @@ import { useCallback, useEffect, useState } from "react";
|
|||
|
||||
import {
|
||||
getToolApiV1ToolsToolUuidGet,
|
||||
listRecordingsApiV1WorkflowRecordingsGet,
|
||||
updateToolApiV1ToolsToolUuidPut,
|
||||
} from "@/client/sdk.gen";
|
||||
import type { ToolResponse, TransferCallConfig as APITransferCallConfig } from "@/client/types.gen";
|
||||
import type { RecordingResponseSchema, ToolResponse, TransferCallConfig as APITransferCallConfig } from "@/client/types.gen";
|
||||
import type { EndCallConfig } from "@/client/types.gen";
|
||||
import { type HttpMethod, type KeyValueItem, type ToolParameter, validateUrl } from "@/components/http";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
|
@ -94,6 +95,9 @@ export default function ToolDetailPage() {
|
|||
const [customMessageType, setCustomMessageType] = useState<'text' | 'audio'>('text');
|
||||
const [customMessageRecordingId, setCustomMessageRecordingId] = useState("");
|
||||
|
||||
// Org-level recordings for audio dropdowns
|
||||
const [recordings, setRecordings] = useState<RecordingResponseSchema[]>([]);
|
||||
|
||||
// Redirect if not authenticated
|
||||
useEffect(() => {
|
||||
if (!loading && !user) {
|
||||
|
|
@ -209,9 +213,24 @@ export default function ToolDetailPage() {
|
|||
}
|
||||
};
|
||||
|
||||
const fetchRecordings = useCallback(async () => {
|
||||
if (loading || !user) return;
|
||||
try {
|
||||
const response = await listRecordingsApiV1WorkflowRecordingsGet({
|
||||
query: {},
|
||||
});
|
||||
if (response.data) {
|
||||
setRecordings(response.data.recordings);
|
||||
}
|
||||
} catch {
|
||||
// Non-critical — dropdowns will show "No recordings available"
|
||||
}
|
||||
}, [loading, user]);
|
||||
|
||||
useEffect(() => {
|
||||
fetchTool();
|
||||
}, [fetchTool]);
|
||||
fetchRecordings();
|
||||
}, [fetchTool, fetchRecordings]);
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!tool) return;
|
||||
|
|
@ -512,6 +531,7 @@ const data = await response.json();`;
|
|||
onCustomMessageChange={setCustomMessage}
|
||||
audioRecordingId={audioRecordingId}
|
||||
onAudioRecordingIdChange={setAudioRecordingId}
|
||||
recordings={recordings}
|
||||
endCallReason={endCallReason}
|
||||
onEndCallReasonChange={handleEndCallReasonChange}
|
||||
endCallReasonDescription={endCallReasonDescription}
|
||||
|
|
@ -531,6 +551,7 @@ const data = await response.json();`;
|
|||
onCustomMessageChange={setCustomMessage}
|
||||
audioRecordingId={transferAudioRecordingId}
|
||||
onAudioRecordingIdChange={setTransferAudioRecordingId}
|
||||
recordings={recordings}
|
||||
timeout={transferTimeout}
|
||||
onTimeoutChange={setTransferTimeout}
|
||||
/>
|
||||
|
|
@ -558,6 +579,7 @@ const data = await response.json();`;
|
|||
onCustomMessageTypeChange={setCustomMessageType}
|
||||
customMessageRecordingId={customMessageRecordingId}
|
||||
onCustomMessageRecordingIdChange={setCustomMessageRecordingId}
|
||||
recordings={recordings}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue