Skip to content

Commit

Permalink
Feat/crud wf build config (#39)
Browse files Browse the repository at this point in the history
* feat:add default graphs and add update graphs method

* feat: refactor code

* fix: remove graphStore because of unknow bug

* chore: add .vscode config to git

* feat:add close button

* feat: add invalidateQueries in readgraphs

* feat:add help in flow pane
  • Loading branch information
Onelevenvy authored Sep 23, 2024
1 parent c009f5c commit 0844503
Show file tree
Hide file tree
Showing 31 changed files with 650 additions and 484 deletions.
30 changes: 30 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [




{
"name": "Debug FastAPI Project backend: Python Debugger",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"justMyCode": false,
"args": ["app.main:app", "--reload"],
"cwd": "${workspaceFolder}/backend",
"jinja": true,
"envFile": "${workspaceFolder}/.env"
},
{
"type": "chrome",
"request": "launch",
"name": "Debug Frontend: Launch Chrome against http://localhost:5173",
"url": "http://localhost:5173",
"webRoot": "${workspaceFolder}/frontend"
}
]
}
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"sqltools.connections": [
{
"previewLimit": 50,
"server": "localhost",
"port": 5432,
"driver": "PostgreSQL",
"name": "next",
"database": "evoagi",
"username": "postgres",
"password": "evoagi123456"
}
]
}
37 changes: 16 additions & 21 deletions backend/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,22 @@ class GraphBase(SQLModel):
sa_column=Column("metadata", JSONB, nullable=False, server_default="{}"),
)


class GraphCreate(GraphBase):
created_at: datetime
updated_at: datetime

class GraphUpdate(GraphBase):
name: str | None = None
updated_at: datetime


class Graph(GraphBase, table=True):
id: int | None = Field(default=None, primary_key=True)
owner_id: int | None = Field(default=None, foreign_key="user.id", nullable=False)
owner: User | None = Relationship(back_populates="graphs")
team_id: int = Field(foreign_key="team.id", nullable=False)
team: Team = Relationship(back_populates="graphs")
created_at: datetime | None = Field(
sa_column=Column(
DateTime(timezone=True),
Expand All @@ -628,27 +644,6 @@ class GraphBase(SQLModel):
)


class GraphCreate(GraphBase):
pass


class GraphUpdate(GraphBase):
config: dict[Any, Any] = Field(default_factory=dict, sa_column=Column(JSONB))
metadata_: dict[Any, Any] = Field(
default_factory=dict,
sa_column=Column("metadata", JSONB, nullable=False, server_default="{}"),
)
updated_at: datetime | None = None


class Graph(GraphBase, table=True):
id: int | None = Field(default=None, primary_key=True)
owner_id: int | None = Field(default=None, foreign_key="user.id", nullable=False)
owner: User | None = Relationship(back_populates="graphs")
team_id: int = Field(foreign_key="team.id", nullable=False)
team: Team = Relationship(back_populates="graphs")


class GraphOut(GraphBase):
id: int

Expand Down
88 changes: 14 additions & 74 deletions web/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3207,35 +3207,15 @@
"title": "Metadata "
},
"created_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"type": "string",
"format": "date-time",
"title": "Created At"
},
"updated_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Updated At"
}
},
"type": "object",
"required": [
"name",
"created_at",
"updated_at"
"created_at"
],
"title": "GraphCreate"
},
Expand Down Expand Up @@ -3265,30 +3245,6 @@
"type": "object",
"title": "Metadata "
},
"created_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Created At"
},
"updated_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Updated At"
},
"id": {
"type": "integer",
"title": "Id"
Expand All @@ -3297,17 +3253,21 @@
"type": "object",
"required": [
"name",
"created_at",
"updated_at",
"id"
],
"title": "GraphOut"
},
"GraphUpdate": {
"properties": {
"name": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]{1,64}$",
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Name"
},
"description": {
Expand All @@ -3329,35 +3289,15 @@
"type": "object",
"title": "Metadata "
},
"created_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"title": "Created At"
},
"updated_at": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"type": "string",
"format": "date-time",
"title": "Updated At"
}
},
"type": "object",
"required": [
"name",
"created_at"
"updated_at"
],
"title": "GraphUpdate"
},
Expand Down
8 changes: 4 additions & 4 deletions web/src/app/(applayout)/playground/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ChatBotList from "@/components/Playground/ChatBotList";
import ChatHistoryList from "@/components/Playground/ChatHistoryList";
import { Box, Center, Flex, useColorModeValue } from "@chakra-ui/react";
import { useState } from "react";
import useChatTeamIdStore from "@/store/chatTeamIDStore";
import useChatTeamIdStore from "@/stores/chatTeamIDStore";
import ChatMain from "@/components/Playground/ChatMain";
import { LuChevronLeft, LuChevronRight } from "react-icons/lu";
import PaneStateControl from "@/components/Common/PaneStateControl";
Expand Down Expand Up @@ -45,7 +45,7 @@ const ChatPlayground = () => {
w={isChatBotListOpen ? "20%" : "0"}
maxW={isChatBotListOpen ? "20%" : "0"}
minW={isChatBotListOpen ? "20%" : "0"}
bg="transparent"
bg="transparent"
border="1px solid #cccccc"
visibility={isChatBotListOpen ? "visible" : "hidden"}
transition="width 0.1s, visibility 0.1s"
Expand Down Expand Up @@ -93,8 +93,8 @@ const ChatPlayground = () => {
maxH="full"
p={4}
mt="0"
bg="transparent"
border="1px solid #cccccc"
bg="transparent"
border="1px solid #cccccc"
borderRadius="md"
overflow="hidden"
visibility={isChatHistoryOpen ? "visible" : "hidden"}
Expand Down
6 changes: 4 additions & 2 deletions web/src/app/(applayout)/teams/[teamId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ function Team() {
</Box>
<Box w="20%">
<DebugPreview
teamId={teamId}
teamId={Number.parseInt(teamId)}
triggerSubmit={triggerSubmit}
useDeployButton={true}
/>
</Box>
</Box>
Expand All @@ -114,8 +115,9 @@ function Team() {
p="2"
>
<WorkflowTeamSettings
teamId={teamId}
teamId={Number.parseInt(teamId)}
triggerSubmit={triggerSubmit}

/>
</Box>
) : (
Expand Down
10 changes: 5 additions & 5 deletions web/src/app/(applayout)/teams/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { RiApps2Line, RiBookLine } from "react-icons/ri";
import { useTabSearchParams } from "@/hooks/useTabSearchparams";
import { GoGitMerge, GoGitPullRequestDraft } from "react-icons/go";
import { PiChatCircleDots } from "react-icons/pi";
import useChatTeamIdStore from "@/store/chatTeamIDStore";
import useChatTeamIdStore from "@/stores/chatTeamIDStore";
import { useTranslation } from "react-i18next";

function Teams() {
Expand All @@ -45,14 +45,14 @@ function Teams() {
showToast("Something went wrong.", `${errDetail}`, "error");
}

const handleRowClick = (teamId: string) => {
const handleRowClick = (teamId: number) => {
navigate.push(`/teams/${teamId}`);
setTeamId(teamId);
};
const options = [
{
value: "all",
text: t(`panestate.team.all`),
text: t(`panestate.team.all`),
icon: <RiApps2Line className="w-[14px] h-[14px] mr-1" />,
},
{
Expand All @@ -67,7 +67,7 @@ function Teams() {
},
{
value: "chatbot",
text:t(`panestate.team.chatbot`),
text: t(`panestate.team.chatbot`),
icon: <PiChatCircleDots className="w-[14px] h-[14px] mr-1" />,
},
{
Expand Down Expand Up @@ -128,7 +128,7 @@ function Teams() {
key={team.id}
_hover={{ backgroundColor: rowTint }}
cursor={"pointer"}
onClick={() => handleRowClick(team.id.toString())}
onClick={() => handleRowClick(team.id)}
p={4}
borderRadius="xl"
borderWidth="1px"
Expand Down
13 changes: 6 additions & 7 deletions web/src/client/models/GraphCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
/* eslint-disable */

export type GraphCreate = {
name: string;
description?: (string | null);
config?: Record<string, any>;
metadata_?: Record<string, any>;
created_at: (string | null);
updated_at: (string | null);
name: string;
description?: string | null;
config?: Record<string, any>;
metadata_?: Record<string, any>;
created_at: string;
updated_at: string;
};

2 changes: 0 additions & 2 deletions web/src/client/models/GraphOut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export type GraphOut = {
description?: (string | null);
config?: Record<string, any>;
metadata_?: Record<string, any>;
created_at: (string | null);
updated_at: (string | null);
id: number;
};

5 changes: 2 additions & 3 deletions web/src/client/models/GraphUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
/* eslint-disable */

export type GraphUpdate = {
name: string;
name?: (string | null);
description?: (string | null);
config?: Record<string, any>;
metadata_?: Record<string, any>;
created_at?: (string | null);
updated_at?: (string | null);
updated_at: string;
};

19 changes: 2 additions & 17 deletions web/src/client/schemas/$GraphCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,9 @@ export const $GraphCreate = {
},
},
created_at: {
type: 'any-of',
contains: [{
type: 'string',
format: 'date-time',
}, {
type: 'null',
}],
isRequired: true,
},
updated_at: {
type: 'any-of',
contains: [{
type: 'string',
format: 'date-time',
}, {
type: 'null',
}],
type: 'string',
isRequired: true,
format: 'date-time',
},
},
} as const;
Loading

0 comments on commit 0844503

Please sign in to comment.