Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/update task status #368

Merged
merged 18 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ model AgentTask {
id String @id @default(cuid())
agentId String
type String
status String?
value String @db.Text
info String? @db.Text
sort Int
Expand Down
2 changes: 0 additions & 2 deletions src/components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ const ChatWindow = ({
const [hasUserScrolled, setHasUserScrolled] = useState(false);
const scrollRef = useRef<HTMLDivElement>(null);

console.log(messages);

const handleScroll = (event: React.UIEvent<HTMLDivElement>) => {
const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;

Expand Down
6 changes: 3 additions & 3 deletions src/pages/agent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import Toast from "../../components/toast";
import { FaTrash, FaShare, FaBackspace } from "react-icons/fa";
import { env } from "../../env/client.mjs";

import { useTranslation } from 'react-i18next';
import { useTranslation } from "react-i18next";

const AgentPage: NextPage = () => {
const [ t ] = useTranslation();
const [t] = useTranslation();
const [showCopied, setShowCopied] = useState(false);
const router = useRouter();

Expand Down Expand Up @@ -75,7 +75,7 @@ const AgentPage: NextPage = () => {
</div>
<Toast
model={[showCopied, setShowCopied]}
title={t('Copied to clipboard! 🚀')}
title={t("Copied to clipboard! 🚀")}
className="bg-gray-950 text-sm"
/>
</DefaultLayout>
Expand Down
3 changes: 2 additions & 1 deletion src/server/api/routers/agentRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { z } from "zod";

import { createTRPCRouter, protectedProcedure, publicProcedure } from "../trpc";
import { prisma } from "../../db";
import { messageSchema } from "../../../types/agentTypes";
import { messageSchema, MESSAGE_TYPE_TASK } from "../../../types/agentTypes";

const saveAgentParser = z.object({
name: z.string(),
Expand All @@ -27,6 +27,7 @@ export const agentRouter = createTRPCRouter({
data: {
agentId: agent.id,
type: e.type,
...(e.type === MESSAGE_TYPE_TASK && { status: e.status }),
info: e.info,
value: e.value,
sort: i,
Expand Down
4 changes: 2 additions & 2 deletions src/types/agentTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ export type TaskStatus = z.infer<typeof TaskStatusSchema>;

export const messageSchemaBase = z.object({
value: z.string(),
info: z.string().optional(),
info: z.string().optional().nullable(),
});

export const taskSchema = z
.object({
taskId: z.string(),
taskId: z.string().optional(),
type: z.literal(MESSAGE_TYPE_TASK),
status: TaskStatusSchema,
})
Expand Down