type fixes

This commit is contained in:
Eng. Elias
2024-02-20 20:32:41 +04:00
parent 619f199abe
commit 7697f09019
6 changed files with 33 additions and 45 deletions

View File

@@ -1,3 +1,5 @@
"use client";
import { tools } from "@/data/data";
import { Agent } from "@/types/agent";
import { Icon } from "@iconify/react";
@@ -92,7 +94,7 @@ export default function AgentModal(props: {
{isEdit ? (
<TETextarea
rows={4}
value={tempAgent?.backstory}
value={tempAgent?.backstory || ""}
onChange={(event) => {
setTempAgent((prevState) => ({
...prevState!,
@@ -175,7 +177,7 @@ export default function AgentModal(props: {
</>
) : (
<img
src={agent?.image}
src={agent?.image ?? "/sailor.png"}
alt="Software Engineer"
className="w-full rounded-lg"
/>

View File

@@ -38,7 +38,7 @@ export default function MissionModal(props: {
useEffect(() => {
initTE({ Collapse });
});
}, []);
return (
<div>
@@ -86,7 +86,7 @@ export default function MissionModal(props: {
value: agent.role,
}))}
multiple
value={tempMission?.crew ?? []}
value={tempMission?.crew.map((agent) => agent.role) ?? []}
onValueChange={(event: any) => {
const newValue = event.map((item: any) => item.value);
setTempMission((prevState) => ({
@@ -102,7 +102,7 @@ export default function MissionModal(props: {
key={i}
className="bg-gray-200 text-gray-700 rounded-full px-3 py-1 text-sm font-semibold m-1 sm:w-1/2"
>
{agent}
{agent.role}
</div>
</>
))
@@ -129,14 +129,14 @@ export default function MissionModal(props: {
{isEdit ? (
<TESelect
data={[
{ text: "Sequential", value: "sequential" },
{ text: "Hierarchical", value: "hierarchical" },
{ text: "SEQUENTIAL", value: "SEQUENTIAL" },
{ text: "HIERARCHICAL", value: "HIERARCHICAL" },
]}
value={tempMission?.process}
onValueChange={(event: any) => {
setTempMission((prevState) => ({
...prevState!,
process: event.value,
process: event?.value,
}));
}}
className="dark:text-black"
@@ -172,7 +172,7 @@ export default function MissionModal(props: {
<div className="ml-3">
<strong>Agent: </strong>
<span className="bg-gray-200 text-gray-700 rounded-full px-3 py-1 text-sm font-semibold m-1 sm:w-1/2">
{task.agent}
{task.agent?.role}
</span>
</div>
}