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

Actions v2 #382

Closed
wants to merge 173 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
39680f1
Remove unused enum
gharbat Dec 6, 2023
418b71f
Code format
gharbat Dec 6, 2023
27e81c6
Add new actions table
gharbat Dec 6, 2023
64a8c50
Add repo
gharbat Dec 6, 2023
748a95b
Add chatbot_id
gharbat Dec 6, 2023
cd1f0de
Add the conroller
gharbat Dec 6, 2023
c06479e
Add base uri to the model
gharbat Dec 6, 2023
d02cc36
Add base uri to the model
gharbat Dec 6, 2023
7ced977
Add new flow renderer component
faltawy Dec 7, 2023
9eb788a
Add new flow renderer component
faltawy Dec 7, 2023
5382922
Merge branch 'major/new-flows-ui' of https://github.com/openchatai/Op…
faltawy Dec 7, 2023
a7aa97d
Add new flow renderer component
faltawy Dec 7, 2023
4915c08
Merge branch 'major/new-flows-ui' of https://github.com/openchatai/Op…
faltawy Dec 7, 2023
ff32ab1
Update lucide-react and reactflow versions
faltawy Dec 7, 2023
538cdae
Add Copilot workflow layout and new flows editor
faltawy Dec 7, 2023
70da793
Add CreateWorkflowForm component
faltawy Dec 7, 2023
e72b9b2
Add WorkflowsTable component
faltawy Dec 7, 2023
e4f24ae
Add WorkflowLayout component
faltawy Dec 7, 2023
17885cd
minor adjustments on base components
faltawy Dec 7, 2023
ea111b1
Add required label to select inputs
faltawy Dec 7, 2023
cbe3cfb
Add workflow page with flow renderer
faltawy Dec 7, 2023
44bcd8a
Merge branch 'main' of https://github.com/openchatai/OpenCopilot into…
faltawy Dec 7, 2023
37c6db5
Adding validations to ActionCreate
codebanesr Dec 8, 2023
0efca7e
Add new action dto
gharbat Dec 9, 2023
36e567b
get_all_actions now support multi request type
gharbat Dec 9, 2023
3cff9ec
Reslove the schema if needed
gharbat Dec 9, 2023
341be70
Return actions as dict or dto
gharbat Dec 9, 2023
240e458
Create copilot without swagger file
gharbat Dec 9, 2023
339e155
Create action
gharbat Dec 9, 2023
d1892e0
Update action
gharbat Dec 9, 2023
d2a470a
Import actions via swagger file
gharbat Dec 9, 2023
2858bde
Create action
gharbat Dec 9, 2023
fc3a702
Merge branch 'main' into feature/skip-swagger-upload-step
gharbat Dec 9, 2023
2508671
Merge branch 'main' into feature/skip-swagger-upload-step
gharbat Dec 9, 2023
321a817
FlowDTO
gharbat Dec 10, 2023
96e2c9f
FlowDTO in the repo
gharbat Dec 10, 2023
ee95a2c
Clean up flowDTO
gharbat Dec 10, 2023
b6f57de
Clean up flowDTO
gharbat Dec 10, 2023
9bd0b26
Code format
gharbat Dec 10, 2023
e0a1f9c
Code format
gharbat Dec 10, 2023
6a35d8d
Code format
gharbat Dec 10, 2023
291a8f4
Test out the actions
gharbat Dec 10, 2023
b7f19c3
Adding pydantic validation
codebanesr Dec 10, 2023
149f73e
Sync action creation with the vector db
gharbat Dec 10, 2023
2961a59
Sync action creation with the vector db
gharbat Dec 10, 2023
c892355
Deperecate swagger files
gharbat Dec 10, 2023
01875bb
Extract paylod from acitons
gharbat Dec 10, 2023
9451e6a
Extract paylod from acitons
gharbat Dec 10, 2023
cdf4ce3
Clean ups
gharbat Dec 10, 2023
7decd21
Clean ups
gharbat Dec 10, 2023
4c12648
hacky fix, must be checked...
codebanesr Dec 10, 2023
cb02f3a
Import actions from swagger files
gharbat Dec 10, 2023
455895a
updating type defs
codebanesr Dec 10, 2023
7a600e1
Import actions from swagger files
gharbat Dec 10, 2023
30a1e46
working example with actions
codebanesr Dec 10, 2023
ae61e3b
Import actions from swagger files
gharbat Dec 10, 2023
b63248e
Code clean up
gharbat Dec 11, 2023
983d838
Code clean up
gharbat Dec 11, 2023
729e7f7
FlowDTO to support bot id and nested actions
gharbat Dec 11, 2023
400be11
Payload -> Blocks
gharbat Dec 11, 2023
2644521
Add flow vector service
gharbat Dec 11, 2023
15427cf
Add flow vector service
gharbat Dec 11, 2023
f719c0f
Add flow vector service
gharbat Dec 11, 2023
d03e215
Add flow vector service
gharbat Dec 11, 2023
74da5ac
Clean app.py
gharbat Dec 11, 2023
f14e895
Fix flow vector service import issues
gharbat Dec 11, 2023
587b8e7
4x faster build times
gharbat Dec 11, 2023
6cd1663
Minimize the vector db payload
gharbat Dec 11, 2023
bf2e95f
Vector DB is working now
gharbat Dec 11, 2023
0d09b58
Cleanups and refactoring
gharbat Dec 11, 2023
be7bda8
Cleanups and refactoring
gharbat Dec 11, 2023
8ebabd9
Add new flow renderer component
faltawy Dec 7, 2023
b295ed7
Update lucide-react and reactflow versions
faltawy Dec 7, 2023
402c8e3
Add Copilot workflow layout and new flows editor
faltawy Dec 7, 2023
b8c5327
Add CreateWorkflowForm component
faltawy Dec 7, 2023
7358e3d
Add WorkflowsTable component
faltawy Dec 7, 2023
b874949
Add WorkflowLayout component
faltawy Dec 7, 2023
fb77524
minor adjustments on base components
faltawy Dec 7, 2023
e7c815f
Add required label to select inputs
faltawy Dec 7, 2023
96aabac
Add workflow page with flow renderer
faltawy Dec 7, 2023
c44a4f9
Base Components Improvments + DND func to new-flow-ui
faltawy Dec 11, 2023
2099255
Merge branch 'major/new-flows-ui' of https://github.com/openchatai/Op…
faltawy Dec 11, 2023
b40205a
Merge branch 'feature/skip-swagger-upload-step' of https://github.com…
faltawy Dec 11, 2023
6fbea3a
Deprecate the old flows system
gharbat Dec 11, 2023
fb6cc51
Deprecate the old flows system
gharbat Dec 11, 2023
40617de
Deprecate the old flows system
gharbat Dec 11, 2023
1d22dde
Deprecate the old flows system
gharbat Dec 11, 2023
a38a345
Remove un-needed vars
gharbat Dec 11, 2023
94cafd7
fixing some issues
codebanesr Dec 11, 2023
fe94cfe
Remove un-needed vars
gharbat Dec 11, 2023
76d73c5
Add request type to the response
gharbat Dec 11, 2023
43ce5b7
See if it will work
gharbat Dec 11, 2023
8814285
default Button Type to `button` instead of `submit`.
faltawy Dec 11, 2023
90b52aa
Move ActionForm component
faltawy Dec 11, 2023
88500a6
Handle On submit-create new action-
faltawy Dec 11, 2023
a8b4d7b
Delete `steps.ts` file
faltawy Dec 11, 2023
0141dae
Add actions and workflow data files
faltawy Dec 11, 2023
a718aa6
Update import path for Union in variables.ts
faltawy Dec 11, 2023
33df635
Refactor types and add API method constants
faltawy Dec 11, 2023
773c45d
Add action form schema and update workflow layout
faltawy Dec 11, 2023
13ed05b
adding qdrant search with embedding
codebanesr Dec 12, 2023
4984e60
knowledgebase done
codebanesr Dec 12, 2023
e96ff5c
handling all scenarios
codebanesr Dec 12, 2023
6fa3b2e
removing magic strings
codebanesr Dec 12, 2023
8b9d9c8
Code cleanup
gharbat Dec 12, 2023
82cbe4c
Merge pull request #393 from openchatai/feature-temp/skip-swagger-upl…
gharbat Dec 12, 2023
edbd6cd
Merge branch 'main' into feature/skip-swagger-upload-step
gharbat Dec 12, 2023
a0d7a7a
Code cleanup
gharbat Dec 12, 2023
8f81bca
Code cleanup
gharbat Dec 12, 2023
4e1dfbe
Code cleanup
gharbat Dec 12, 2023
bea0c85
Code cleanup
gharbat Dec 12, 2023
3d9cbe1
fix parameter position
gharbat Dec 12, 2023
c38757e
Add a new script to load all actions from all swagger files
gharbat Dec 12, 2023
27d14d4
Remove mongo from the re-index script
gharbat Dec 12, 2023
5b3ff14
Make the script contioue when it fail
gharbat Dec 12, 2023
b28766b
Make the script contioue when it fail
gharbat Dec 12, 2023
7ada76e
Make the script contioue when it fail
gharbat Dec 12, 2023
ff01b8d
Remove the old swagger re-index file
gharbat Dec 12, 2023
10b0f2a
Remove the old swagger re-index file
gharbat Dec 12, 2023
1c23ff9
Code cleanup
gharbat Dec 12, 2023
7544b9a
Code cleanup
gharbat Dec 12, 2023
406caf7
Code cleanup
gharbat Dec 12, 2023
e1ed9a6
Conversation with actionable items
gharbat Dec 12, 2023
a820519
Conversation with actionable items
gharbat Dec 12, 2023
1cbded5
Connect the flow/action vector results with the presenter
gharbat Dec 12, 2023
2bed53a
Connect the flow/action vector results with the presenter
gharbat Dec 12, 2023
2c1a66e
Code cleanup
gharbat Dec 12, 2023
74c96f3
Add run_informative_item method
gharbat Dec 13, 2023
5db105b
Add run_informative_item method
gharbat Dec 13, 2023
6fd1bfc
Change create copilot base url
gharbat Dec 13, 2023
96a3de9
Change create copilot base url
gharbat Dec 13, 2023
f4f17ac
Change create copilot base url
gharbat Dec 13, 2023
1192352
Change create copilot base url
gharbat Dec 13, 2023
678182b
Informative response
gharbat Dec 13, 2023
5bcb3c8
Add dev:debug script and cross-env dependency
faltawy Dec 13, 2023
b1e0d19
Add launch.json configuration for Next.js debugging
faltawy Dec 13, 2023
3bf9b70
Add `min-width:0` to all elements
faltawy Dec 13, 2023
487a8e1
Merge branch 'major/new-flows-ui' of https://github.com/openchatai/Op…
faltawy Dec 13, 2023
6d34893
Small working example
gharbat Dec 13, 2023
400eadd
Small working example
gharbat Dec 13, 2023
aa7c5d1
Small working example
gharbat Dec 13, 2023
6925ce7
Add min-height property to all elements
faltawy Dec 13, 2023
3b73eac
Update actions.ts and copilot.ts
faltawy Dec 13, 2023
5565fc4
Add xs size variant to button
faltawy Dec 13, 2023
c0e7d97
Add MethodRenderer component with methodVariants constant
faltawy Dec 13, 2023
c8d0751
Delete file cc
faltawy Dec 13, 2023
59e63c6
Add useSearchParams hook for managing URL search parameters
faltawy Dec 13, 2023
47cc079
cleaning up
faltawy Dec 13, 2023
dedd102
Refactor CreateCopilotProvider.tsx
faltawy Dec 13, 2023
3842132
Refactor SwaggerUi component to use Button component
faltawy Dec 13, 2023
257bd92
Update ActionsList and Renderer components
faltawy Dec 13, 2023
a44812c
Refactor copilot settings page and workflow layout
faltawy Dec 13, 2023
49972e9
String comparison instead of json/dict
gharbat Dec 13, 2023
e4d0c56
Remove unused import and fix import path
faltawy Dec 13, 2023
975e9b8
deleted: routes/_swagger/controller.py
gharbat Dec 13, 2023
4bf0015
Public folder serving and Caching
faltawy Dec 13, 2023
da88171
Refactor copilot settings page
faltawy Dec 13, 2023
36c969d
Delete unused Swagger form files
faltawy Dec 13, 2023
76910b0
Refactor revalidateActions function and remove unused code
faltawy Dec 13, 2023
fdbb9f2
Merge pull request #395 from openchatai/feature/conversation-v2
gharbat Dec 14, 2023
9d02403
Remove unused import
gharbat Dec 14, 2023
503de4d
Remove swagger routes
gharbat Dec 14, 2023
6e562ef
Small prompt changes
gharbat Dec 14, 2023
0990a74
Better prompting
gharbat Dec 14, 2023
ecd91c7
Better prompting
gharbat Dec 14, 2023
119283e
Fix flow updates
gharbat Dec 15, 2023
246db00
Fix flow updates
gharbat Dec 15, 2023
304b5b3
Add id to blocks
gharbat Dec 16, 2023
0234ce4
Writing an endpoint for dynamic builder
codebanesr Dec 16, 2023
0508c68
Fix flow updates
gharbat Dec 16, 2023
73cd98d
Migrate old workwflows to the new one
gharbat Dec 16, 2023
d4c2a95
Migrate old workwflows to the new one
gharbat Dec 16, 2023
04b3314
dynamic flow builder complete
codebanesr Dec 17, 2023
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
Empty file removed cc
Empty file.
28 changes: 28 additions & 0 deletions dashboard/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev",
"serverReadyAction": {
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
}
]
}
50 changes: 33 additions & 17 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,60 @@
# Start with a base node image
FROM node:18-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# Install corepack and pnpm
RUN corepack enable
RUN corepack prepare [email protected] --activate
# Dependencies image
FROM base AS deps

# Add libc6-compat if necessary for your application
RUN apk add --no-cache libc6-compat

WORKDIR /app

COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN pnpm i --frozen-lockfile
# Copy package files
COPY package.json pnpm-lock.yaml* ./

# Install dependencies
# This layer will be cached unless package.json or pnpm-lock.yaml changes
RUN pnpm i --frozen-lockfile

# Builder image
FROM base AS builder

WORKDIR /app

# Copy installed node_modules from deps stage
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED 1
# Copy the rest of your application's source code
COPY . .

# RUN yarn build
# Build your application
RUN pnpm run build

# Production image, copy all the files and run next
# Production image
FROM base AS runner
WORKDIR /app

# Set environment variables
ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
ENV PORT 8000
ENV HOSTNAME "0.0.0.0"

WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public
# Create a non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs

# Copy the build output and necessary files from builder stage
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

# copy public folder
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
USER nextjs

EXPOSE 8000

ENV PORT 8000
ENV HOSTNAME "0.0.0.0"

CMD ["node", "server.js"]
CMD ["node", "server.js"]
4 changes: 2 additions & 2 deletions dashboard/app/(copilot)/copilot/[copilot_id]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function CopilotLayout({ children, params }: Props) {
<Separator className="my-2" />
<div className="flex flex-col items-center gap-4">
<CopilotLayoutNavLink
href={copilotBase + "/flows"}
href={copilotBase + "/workflow"}
IconComponent={Workflow}
label="Flows"
/>
Expand Down Expand Up @@ -124,7 +124,7 @@ export default function CopilotLayout({ children, params }: Props) {
</div>
</aside>
<main className="flex flex-1 flex-col overflow-hidden">
<div className="h-full max-w-full flex-1 bg-primary-foreground">
<div className="h-full min-h-full max-w-full flex-1 bg-primary-foreground">
<CopilotProvider>{children}</CopilotProvider>
</div>
</main>
Expand Down
20 changes: 13 additions & 7 deletions dashboard/app/(copilot)/copilot/[copilot_id]/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ import { useRouter } from "next/navigation";
import { toast } from "@/components/ui/use-toast";
import { CopyButton } from "@/components/headless/CopyButton";
import { mutate } from "swr";
import { useAsyncFn } from "react-use";

export default function GeneralSettingsPage() {
const { token, id: copilotId, name: copilotName } = useCopilot();
const [Name, setName] = React.useState(copilotName);
const { replace } = useRouter();
const [deleteCopilotstate, $deleteCopilot] = useAsyncFn(deleteCopilot);
const [updateCopilotState, $updateCopilot] = useAsyncFn(updateCopilot);

async function handleDelete() {
const response = await deleteCopilot(copilotId);
if (response.data.success) {
const { data } = await $deleteCopilot(copilotId);
if (data.success) {
toast({
variant: "success",
title: "Copilot deleted",
Expand All @@ -35,11 +41,11 @@ export default function GeneralSettingsPage() {
_.delay(() => replace("/"), 1000);
}
}
const [Name, setName] = React.useState(copilotName);

async function handleSave() {
if (Name === copilotName || Name.trim().length < 1) return;
const { data: respData } = await updateCopilot(copilotId, { name: Name });
if (respData.chatbot) {
const { data } = await $updateCopilot(copilotId, { name: Name });
if (data.chatbot) {
toast({
variant: "success",
title: "Copilot updated",
Expand All @@ -55,7 +61,7 @@ export default function GeneralSettingsPage() {
General settings
</h1>
<div className="space-x-2">
<Button size="sm" onClick={handleSave}>
<Button size="sm" loading={updateCopilotState.loading} onClick={handleSave}>
Save
</Button>
</div>
Expand Down Expand Up @@ -148,7 +154,7 @@ export default function GeneralSettingsPage() {
<AlertDialogCancel asChild>
<Button variant="outline">Cancel</Button>
</AlertDialogCancel>
<Button variant="destructive" onClick={handleDelete}>
<Button variant="destructive" loading={deleteCopilotstate.loading} onClick={handleDelete}>
Delete
</Button>
</AlertDialogFooter>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { HeaderShell } from '@/components/domain/HeaderShell'
import { FlowsControllerV2 } from '@/components/domain/new-flows-editor/Controller'
import { Button } from '@/components/ui/button'
import React from 'react'

type Props = {
children: React.ReactNode
}

function WorkflowLayout({
children
}: Props) {
return (
<FlowsControllerV2>
<div className='h-full flex flex-col'>
<HeaderShell className='justify-between'>
<h2 className='text-lg font-semibold'>Edit Workflow</h2>
<div className='space-x-2'>
<Button>
Save
</Button>
<Button variant='destructive'>
Delete
</Button>
</div>
</HeaderShell>
<div className='flex-1 min-h-0'>
{children}
</div>
</div>
</FlowsControllerV2>

)
}

export default WorkflowLayout
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { FlowRenderer } from '@/components/domain/new-flows-editor/Renderer'
import React from 'react'


export default function WorkflowPage() {
return (
<FlowRenderer />
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
'use client';
import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from '@/components/ui/alert-dialog';
import { Button } from '@/components/ui/button';
import React from 'react'
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { zodResolver } from '@hookform/resolvers/zod';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
import { Switch } from '@/components/ui/switch';


const formSchema = z.object({
title: z.string().min(2, {
message: "title must be at least 2 characters.",
}),
description: z.string().min(2, {
message: "description must be at least 2 characters.",
}),
edit_after_creation: z.boolean().default(false),
})


export default function CreateWorkflowForm() {
const form = useForm({
resolver: zodResolver(formSchema),
defaultValues: {
title: '',
description: '',
edit_after_creation: false,
}
})
function onSubmit(values: z.infer<typeof formSchema>) {
console.log(values)
}
return (
<AlertDialog>
<AlertDialogTrigger asChild>
<Button>
Create Flow
</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Create Flow</AlertDialogTitle>
<AlertDialogDescription>
Flows are a sequence of steps that are executed when a user interacts with your bot.
</AlertDialogDescription>
</AlertDialogHeader>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className='space-y-2'>
<FormField
control={form.control}
name="title"
render={({ field }) => (
<FormItem>
<FormLabel className="required-label">
Title
</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="description"
render={({ field }) => (
<FormItem>
<FormLabel className='required-label'>
Description
</FormLabel>
<FormControl>
<Textarea minRows={3} {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="edit_after_creation"
render={({ field }) => {
const { value, ...rest } = field;
return <FormItem className='flex items-center justify-between'>
<FormLabel>
Edit after creation
</FormLabel>
<FormControl>
<Switch
{...rest}
checked={value}
onCheckedChange={() => {
field.onChange(!value)
}}
value={value ? 'on' : 'off'}
/>
</FormControl>
<FormMessage />
</FormItem>
}
}
/>
<AlertDialogFooter className='!mt-5'>
<AlertDialogCancel type='button'>
Cancel
</AlertDialogCancel>
<Button type='submit'>
Create
</Button>
</AlertDialogFooter>
</form>
</Form>
</AlertDialogContent>
</AlertDialog>
)
}
Loading