mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-22 11:51:04 +02:00
chore: render initial and gathered context
This commit is contained in:
parent
3afae6cf09
commit
cc2d3e70d2
3 changed files with 51 additions and 5 deletions
|
|
@ -284,7 +284,7 @@ TTSConfig = Annotated[
|
||||||
###################################################### STT ########################################################################
|
###################################################### STT ########################################################################
|
||||||
|
|
||||||
|
|
||||||
DEEPGRAM_STT_MODELS = ["nova-3-general"]
|
DEEPGRAM_STT_MODELS = ["nova-2", "nova-3-general"]
|
||||||
DEEPGRAM_LANGUAGES = [
|
DEEPGRAM_LANGUAGES = [
|
||||||
"multi",
|
"multi",
|
||||||
"en",
|
"en",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
|
from loguru import logger
|
||||||
|
|
||||||
from api.constants import MPS_API_URL
|
from api.constants import MPS_API_URL
|
||||||
from api.services.configuration.registry import ServiceProviders
|
from api.services.configuration.registry import ServiceProviders
|
||||||
|
|
@ -32,8 +33,12 @@ def create_stt_service(user_config):
|
||||||
# Use language from user config, defaulting to "multi" for multilingual support
|
# Use language from user config, defaulting to "multi" for multilingual support
|
||||||
language = getattr(user_config.stt, "language", None) or "multi"
|
language = getattr(user_config.stt, "language", None) or "multi"
|
||||||
live_options = LiveOptions(
|
live_options = LiveOptions(
|
||||||
language=language, profanity_filter=False, endpointing=100
|
language=language,
|
||||||
|
profanity_filter=False,
|
||||||
|
endpointing=100,
|
||||||
|
model=user_config.stt.model,
|
||||||
)
|
)
|
||||||
|
logger.debug(f"Using DeepGram Model - {user_config.stt.model}")
|
||||||
return DeepgramSTTService(
|
return DeepgramSTTService(
|
||||||
live_options=live_options,
|
live_options=live_options,
|
||||||
api_key=user_config.stt.api_key,
|
api_key=user_config.stt.api_key,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { FileText, Video } from 'lucide-react';
|
import { Check, Copy, FileText, Video } from 'lucide-react';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import { useParams } from 'next/navigation';
|
import { useParams } from 'next/navigation';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
|
@ -25,6 +25,47 @@ interface WorkflowRunResponse {
|
||||||
gathered_context: Record<string, string | number | boolean | object> | null;
|
gathered_context: Record<string, string | number | boolean | object> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ContextDisplay({ title, context }: { title: string; context: Record<string, string | number | boolean | object> | null }) {
|
||||||
|
const [copied, setCopied] = useState(false);
|
||||||
|
|
||||||
|
const handleCopy = () => {
|
||||||
|
if (!context) return;
|
||||||
|
navigator.clipboard.writeText(JSON.stringify(context, null, 2));
|
||||||
|
setCopied(true);
|
||||||
|
setTimeout(() => setCopied(false), 2000);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!context || Object.keys(context).length === 0) {
|
||||||
|
return (
|
||||||
|
<Card className="border-border">
|
||||||
|
<CardHeader className="pb-2">
|
||||||
|
<CardTitle className="text-lg">{title}</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<p className="text-sm text-muted-foreground">No data available</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card className="border-border">
|
||||||
|
<CardHeader className="flex flex-row items-center justify-between pb-2">
|
||||||
|
<CardTitle className="text-lg">{title}</CardTitle>
|
||||||
|
<Button variant="ghost" size="sm" onClick={handleCopy} className="gap-2">
|
||||||
|
{copied ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
|
||||||
|
{copied ? 'Copied' : 'Copy'}
|
||||||
|
</Button>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<pre className="text-sm bg-muted p-3 rounded-md overflow-auto max-h-64">
|
||||||
|
{JSON.stringify(context, null, 2)}
|
||||||
|
</pre>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export default function WorkflowRunPage() {
|
export default function WorkflowRunPage() {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
|
|
@ -174,7 +215,7 @@ export default function WorkflowRunPage() {
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{/* <div className="grid gap-6 md:grid-cols-2">
|
<div className="grid gap-6 md:grid-cols-2">
|
||||||
<ContextDisplay
|
<ContextDisplay
|
||||||
title="Initial Context"
|
title="Initial Context"
|
||||||
context={workflowRun?.initial_context}
|
context={workflowRun?.initial_context}
|
||||||
|
|
@ -183,7 +224,7 @@ export default function WorkflowRunPage() {
|
||||||
title="Gathered Context"
|
title="Gathered Context"
|
||||||
context={workflowRun?.gathered_context}
|
context={workflowRun?.gathered_context}
|
||||||
/>
|
/>
|
||||||
</div> */}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue