Integrate v2 task api (#1566)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { getClient } from "@/api/AxiosClient";
|
||||
import { ObserverCruise, TaskGenerationApiResponse } from "@/api/types";
|
||||
import { ObserverTask, TaskGenerationApiResponse } from "@/api/types";
|
||||
import img from "@/assets/promptBoxBg.png";
|
||||
import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea";
|
||||
import { CartIcon } from "@/components/icons/CartIcon";
|
||||
@@ -128,9 +128,9 @@ function PromptBox() {
|
||||
|
||||
const startObserverCruiseMutation = useMutation({
|
||||
mutationFn: async (prompt: string) => {
|
||||
const client = await getClient(credentialGetter);
|
||||
return client.post<{ user_prompt: string }, { data: ObserverCruise }>(
|
||||
"/cruise",
|
||||
const client = await getClient(credentialGetter, "v2");
|
||||
return client.post<{ user_prompt: string }, { data: ObserverTask }>(
|
||||
"/tasks",
|
||||
{ user_prompt: prompt },
|
||||
);
|
||||
},
|
||||
|
||||
@@ -265,7 +265,7 @@ function WorkflowRun() {
|
||||
handleSetActiveItem("stream");
|
||||
}}
|
||||
onObserverThoughtCardSelected={(item) => {
|
||||
handleSetActiveItem(item.observer_thought_id);
|
||||
handleSetActiveItem(item.thought_id);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@ export type WorkflowRunTimelineItemType =
|
||||
(typeof WorkflowRunTimelineItemTypes)[keyof typeof WorkflowRunTimelineItemTypes];
|
||||
|
||||
export type ObserverThought = {
|
||||
observer_thought_id: string;
|
||||
thought_id: string;
|
||||
user_input: string | null;
|
||||
observation: string | null;
|
||||
thought: string | null;
|
||||
@@ -123,7 +123,7 @@ export function isObserverThought(item: unknown): item is ObserverThought {
|
||||
return (
|
||||
typeof item === "object" &&
|
||||
item !== null &&
|
||||
"observer_thought_id" in item &&
|
||||
"thought_id" in item &&
|
||||
"thought" in item
|
||||
);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ function WorkflowPostRunParameters() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{workflowRun.observer_cruise ? (
|
||||
{workflowRun.observer_task ? (
|
||||
<div className="rounded bg-slate-elevation2 p-6">
|
||||
<div className="space-y-4">
|
||||
<h1 className="text-lg font-bold">Observer Parameters</h1>
|
||||
@@ -152,7 +152,7 @@ function WorkflowPostRunParameters() {
|
||||
</h2>
|
||||
</div>
|
||||
<AutoResizingTextarea
|
||||
value={workflowRun.observer_cruise.prompt ?? ""}
|
||||
value={workflowRun.observer_task.prompt ?? ""}
|
||||
readOnly
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -77,7 +77,7 @@ function WorkflowRunOutput() {
|
||||
? formatExtractedInformation(outputs)
|
||||
: outputs;
|
||||
const fileUrls = workflowRun?.downloaded_file_urls ?? [];
|
||||
const observerOutput = workflowRun?.observer_cruise?.output;
|
||||
const observerOutput = workflowRun?.observer_task?.output;
|
||||
|
||||
return (
|
||||
<div className="space-y-5">
|
||||
|
||||
@@ -77,9 +77,7 @@ function WorkflowRunOverview() {
|
||||
/>
|
||||
)}
|
||||
{isObserverThought(selection) && (
|
||||
<ObserverThoughtScreenshot
|
||||
observerThoughtId={selection.observer_thought_id}
|
||||
/>
|
||||
<ObserverThoughtScreenshot observerThoughtId={selection.thought_id} />
|
||||
)}
|
||||
</AspectRatio>
|
||||
);
|
||||
|
||||
@@ -119,11 +119,10 @@ function WorkflowRunTimeline({
|
||||
if (isThoughtItem(timelineItem)) {
|
||||
return (
|
||||
<ThoughtCard
|
||||
key={timelineItem.thought.observer_thought_id}
|
||||
key={timelineItem.thought.thought_id}
|
||||
active={
|
||||
isObserverThought(activeItem) &&
|
||||
activeItem.observer_thought_id ===
|
||||
timelineItem.thought.observer_thought_id
|
||||
activeItem.thought_id === timelineItem.thought.thought_id
|
||||
}
|
||||
onClick={onObserverThoughtCardSelected}
|
||||
thought={timelineItem.thought}
|
||||
|
||||
@@ -64,10 +64,7 @@ function findActiveItem(
|
||||
) {
|
||||
return current.block;
|
||||
}
|
||||
if (
|
||||
current.type === "thought" &&
|
||||
current.thought.observer_thought_id === target
|
||||
) {
|
||||
if (current.type === "thought" && current.thought.thought_id === target) {
|
||||
return current.thought;
|
||||
}
|
||||
if (current.type === "block") {
|
||||
|
||||
Reference in New Issue
Block a user