Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into azure_model
Browse files Browse the repository at this point in the history
# Conflicts:
#	platform/poetry.lock
#	platform/pyproject.toml
#	platform/reworkd_platform/tests/test_settings.py
#	platform/reworkd_platform/web/api/workflow/blocks/web/__init__.py
#	platform/reworkd_platform/web/api/workflowchat/views.py
  • Loading branch information
awtkns committed Sep 25, 2023
2 parents a2faabe + 307f65f commit 28e4a41
Show file tree
Hide file tree
Showing 99 changed files with 947 additions and 7,119 deletions.
21 changes: 0 additions & 21 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,27 +68,6 @@ services:
volumes:
- weaviate:/var/lib/weaviate

# Central routing / management for selenium
selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"

# Running selenium instance. An instance will block per request so we need to scale this out
chrome:
image: seleniarm/node-chromium
# image: selenium/node-chrome:4 # If you're on an non-ARM system
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443

volumes:
weaviate:
db_data:
996 changes: 119 additions & 877 deletions next/package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@vercel/analytics": "^1.0.1",
"@vercel/edge": "^0.3.4",
"axios": "^0.26.0",
"cheerio": "^1.0.0-rc.12",
"clsx": "^1.2.1",
"cookies-next": "^2.1.2",
"framer-motion": "^10.12.8",
Expand All @@ -48,14 +49,12 @@
"next-auth": "4.20.1",
"next-i18next": "^13.2.2",
"nextjs-google-analytics": "^2.3.3",
"pusher-js": "^8.2.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "^12.3.1",
"react-icons": "^4.8.0",
"react-markdown": "^8.0.7",
"react-type-animation": "^3.1.0",
"reactflow": "^11.7.4",
"rehype-highlight": "^6.0.0",
"remark-gfm": "^3.0.1",
"superjson": "1.9.1",
Expand Down
60 changes: 0 additions & 60 deletions next/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -188,63 +188,3 @@ model Task {
@@index([run_id])
@@map("agent_task")
}

// WORKFLOW
model Workflow {
id String @id @default(cuid())
user_id String
organization_id String?
name String
description String @default("")
create_date DateTime @default(now())
update_date DateTime? @updatedAt
delete_date DateTime?
nodes WorkflowNode[]
edges WorkflowEdge[]
@@map("workflow")
}

model WorkflowEdge {
id String @id @default(cuid())
workflow_id String
source String @db.VarChar(36)
source_handle String? @db.VarChar(36)
target String @db.VarChar(36)
workflow Workflow @relation(fields: [workflow_id], references: [id], onDelete: Cascade)
@@unique([workflow_id, source, target, source_handle])
@@map("workflow_edge")
}

model WorkflowNode {
id String @id @default(cuid())
ref String @db.VarChar(12)
workflow_id String
pos_x Float
pos_y Float
create_date DateTime @default(now())
update_date DateTime? @updatedAt
delete_date DateTime?
workflow Workflow @relation(fields: [workflow_id], references: [id], onDelete: Cascade)
NodeBlock NodeBlock[]
@@unique([workflow_id, ref])
@@map("workflow_node")
}

model NodeBlock {
id String @id @default(cuid())
node_id String
type String
input Json
workflow_node WorkflowNode @relation(fields: [node_id], references: [id], onDelete: Cascade)
@@index([node_id])
@@map("node_block")
}
Binary file added next/public/errorFavicon.ico
Binary file not shown.
18 changes: 14 additions & 4 deletions next/src/components/console/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FaCheck } from "react-icons/fa";
import { FiClipboard } from "react-icons/fi";

import MarkdownRenderer from "./MarkdownRenderer";
import SourceCard from "./SourceCard";
import type { Message } from "../../types/message";
import { MESSAGE_TYPE_GOAL, MESSAGE_TYPE_SYSTEM } from "../../types/message";
import {
Expand Down Expand Up @@ -41,27 +42,36 @@ const ChatMessage = ({ message }: { message: Message }) => {
>
{message.type !== MESSAGE_TYPE_SYSTEM && !isAction(message) && (
<>
<div className="mr-2 inline-block h-[0.9em]">{getTaskStatusIcon(message, {})}</div>
<div className="mr-2 inline-block h-[0.9em]">
{getTaskStatusIcon(message, {})}
</div>
<span className="mr-2 font-bold">{getMessagePrefix(message)}</span>
</>
)}

{isAction(message) ? (
<>
<div className="flex flex-row">
<div className="mr-2 inline-block h-[0.9em]">{getTaskStatusIcon(message, {})}</div>
<span className="mr-2 flex-1 font-bold">{getMessagePrefix(message)}</span>
<div className="mr-2 inline-block h-[0.9em]">
{getTaskStatusIcon(message, {})}
</div>
<span className="mr-2 flex-1 font-bold">
{getMessagePrefix(message)}
</span>
<Button
className="justify-end text-zinc-400 hover:text-white"
onClick={handleCopy}
aria-label="Copy"
>
<div className="w-full">{isCopied ? <FaCheck /> : <FiClipboard size={15} />}</div>
<div className="w-full">
{isCopied ? <FaCheck /> : <FiClipboard size={15} />}
</div>
</Button>
</div>
<hr className="my-2 border border-white/20" />
<div>
<MarkdownRenderer>{message.info || ""}</MarkdownRenderer>
<SourceCard messageInfo={message.info || ""} />
</div>
</>
) : (
Expand Down
2 changes: 1 addition & 1 deletion next/src/components/console/MarkdownRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const CustomLink = ({ children, href }) => {
return (
<a
className={clsx(
"link rounded-full bg-zinc-800 px-2 py-0.5 align-top text-[0.6rem]",
"mx-0.5 rounded-full bg-sky-600 px-1.5 py-0.5 align-top text-[0.6rem] text-white",
"transition-colors duration-300 hover:bg-sky-500 hover:text-white"
)}
href={href as string}
Expand Down
31 changes: 31 additions & 0 deletions next/src/components/console/SourceCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import clsx from "clsx";
import { SyntheticEvent } from "react";
import SourceLink from "./SourceLink";
import { api } from "../../utils/api";

interface MessageInfo {
messageInfo: string;
}

const SourceCard = ({ messageInfo }: MessageInfo) => {
const regex = /(?=\[(!\[.+?\]\(.+?\)|.+?)]\((https?:\/\/[^\)]+)\))/gi;
const linksSet = new Set<string>();
const linksMatches = [...messageInfo.matchAll(regex)];
linksMatches.forEach((m) => linksSet.add(m[2] as string));
const linksArray = Array.from(linksSet);

if (linksArray.length === 0) return null;

return (
<>
<hr className="my-2 border border-white/20" />
<div className="grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-4" >
{linksArray.map((link, index) => {
return <SourceLink key={link} link={link} index={index} />;
})}
</div>
</>
);
};

export default SourceCard;
58 changes: 58 additions & 0 deletions next/src/components/console/SourceLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import type { SyntheticEvent } from "react";

import { api } from "../../utils/api";
import FadeIn from "../motions/FadeIn";

interface LinkInfo {
link: string;
index: number;
}

const SourceLink = ({ link, index }: LinkInfo) => {
const linkMeta = api.linkMeta.get.useQuery(link);
const addImageFallback = (event: SyntheticEvent<HTMLImageElement, Event>) => {
event.currentTarget.src = "/errorFavicon.ico";
};

return (
<FadeIn>
<a href={link} target="_blank">
<div className="group h-full space-y-2 rounded border border-white/20 bg-white/5 p-2 transition-colors duration-300 hover:bg-white/10">
{linkMeta.isLoading ? (
<div className="animate-pulse space-y-2">
<div className="h-2 rounded bg-gray-500"></div>
<div className="h-2 rounded bg-gray-500"></div>
<div className="flex items-center gap-2">
<div className="h-4 w-4 rounded bg-gray-500"></div>
<div className="h-2 w-2/3 rounded bg-gray-500"></div>
</div>
</div>
) : linkMeta.isSuccess ? (
<>
<p className="line-clamp-2 text-xs">{linkMeta.data.title}</p>
<div className="flex gap-2">
<img
className="inline h-4 w-4"
src={linkMeta.data.favicon || ""}
alt="Logo"
onError={addImageFallback}
/>
<p className="line-clamp-1">{linkMeta.data.hostname}</p>
<p className="rounded-full bg-white/20 px-1 text-gray-300 transition-colors duration-300 group-hover:bg-sky-600">
{index + 1}
</p>
</div>
</>
) : linkMeta.isError ? (
<div className="flex gap-2">
<p className="line-clamp-1">{link}</p>
<p className="rounded-full bg-white/20 px-1 text-gray-300">{index + 1}</p>
</div>
) : null}
</div>
</a>
</FadeIn>
);
};

export default SourceLink;
98 changes: 0 additions & 98 deletions next/src/components/drawer/LogSidebar.tsx

This file was deleted.

Loading

0 comments on commit 28e4a41

Please sign in to comment.