add dataSchema to task v2 UI (#1966)
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { toast } from "@/components/ui/use-toast";
|
||||
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
|
||||
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
|
||||
import {
|
||||
FileTextIcon,
|
||||
GearIcon,
|
||||
@@ -153,6 +154,7 @@ function PromptBox() {
|
||||
const [totpIdentifier, setTotpIdentifier] = useState("");
|
||||
const [maxStepsOverride, setMaxStepsOverride] = useState<string | null>(null);
|
||||
const [showAdvancedSettings, setShowAdvancedSettings] = useState(false);
|
||||
const [dataSchema, setDataSchema] = useState<string | null>(null);
|
||||
|
||||
const startObserverCruiseMutation = useMutation({
|
||||
mutationFn: async (prompt: string) => {
|
||||
@@ -165,6 +167,15 @@ function PromptBox() {
|
||||
proxy_location: proxyLocation,
|
||||
totp_identifier: totpIdentifier,
|
||||
publish_workflow: publishWorkflow,
|
||||
extracted_information_schema: dataSchema
|
||||
? (() => {
|
||||
try {
|
||||
return JSON.parse(dataSchema);
|
||||
} catch (e) {
|
||||
return dataSchema;
|
||||
}
|
||||
})()
|
||||
: null,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
@@ -409,6 +420,24 @@ function PromptBox() {
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-16">
|
||||
<div className="w-48 shrink-0">
|
||||
<div className="text-sm">Data Schema</div>
|
||||
<div className="text-xs text-slate-400">
|
||||
Specify the output data schema in JSON format
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<CodeEditor
|
||||
value={dataSchema ?? ""}
|
||||
onChange={(value) => setDataSchema(value || null)}
|
||||
language="json"
|
||||
minHeight="100px"
|
||||
maxHeight="500px"
|
||||
fontSize={8}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
@@ -839,7 +839,7 @@ async def delete_workflow(
|
||||
|
||||
|
||||
@base_router.get("/workflows", response_model=list[Workflow])
|
||||
@base_router.get("/workflows/", response_model=list[Workflow])
|
||||
@base_router.get("/workflows/", response_model=list[Workflow], include_in_schema=False)
|
||||
async def get_workflows(
|
||||
page: int = Query(1, ge=1),
|
||||
page_size: int = Query(10, ge=1),
|
||||
|
||||
Reference in New Issue
Block a user