Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/n4ze3m/dialoqbase
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 27, 2024
2 parents 8c98e7e + 3ea6327 commit ad9baf6
Show file tree
Hide file tree
Showing 12 changed files with 189 additions and 137 deletions.
2 changes: 1 addition & 1 deletion app/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "app",
"private": true,
"version": "1.7.1",
"version": "1.7.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
96 changes: 96 additions & 0 deletions app/ui/src/components/Bot/Integration/IntegrationCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import React from "react";
import { useDarkMode } from "../../../hooks/useDarkmode";
import { Link } from "react-router-dom";

type Prosp = {
href?: string;
onClick?: () => void;
logo: string;
name: string;
color: string;
textColor: string;
status?: string;
description: string;
};

export const IntegrationCard: React.FC<Prosp> = ({
href,
onClick,
logo,
name,
color,
textColor,
status,
description,
}) => {
const { mode } = useDarkMode();

return !href ? (
<div className="relative group bg-white p-6 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-500 rounded-lg overflow-hidden border hover:shadow-lg transition-shadow duration-300 ease-in-out cursor-pointer dark:bg-[#0a0a0a] dark:border-[#232222] dark:hover:bg-[#1a1a1a] dark:hover:border-[#232222] hover:bg-gray-50">
<button
// onClick={() => {
// setSelectedIntegration(integration);
// setOpen(true);
// }}
onClick={onClick}
>
<div className="mb-4">
<div className="flex items-center justify-between">
<img className="h-12 w-auto" src={logo} alt={name} />
<div className="ml-2 flex flex-shrink-0">
<p
className={`inline-flex rounded-md px-2 text-sm leading-5 border border-transparent uppercase tracking-widest dark:bg-[#232222] dark:text-[#fff] dark:border-[#232222] dark:hover:bg-[#232222] dark:hover:text-[#fff] dark:hover:border-[#232222]
`}
style={{
backgroundColor: mode !== "dark" ? color : undefined,
color: mode !== "dark" ? textColor : undefined,
borderColor:
mode !== "dark"
? color !== "#fff"
? color
: "#000"
: undefined,
}}
>
{status}
</p>
</div>
</div>
</div>
<div className="sm:flex sm:items-center">
<div className="text-left">
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-white">
{name}
</h3>
<p className="mt-2 text-xs text-gray-500 dark:text-gray-400">
{description}
</p>
</div>
</div>
</button>
</div>
) : (
<Link
to={href}
className="relative group bg-white p-6 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-500 rounded-lg overflow-hidden border hover:shadow-lg transition-shadow duration-300 ease-in-out cursor-pointer dark:bg-[#0a0a0a] dark:border-[#232222] dark:hover:bg-[#1a1a1a] dark:hover:border-[#232222] hover:bg-gray-50"
>
<div>
<div className="mb-4">
<div className="flex items-center justify-between">
<img className="h-12 w-auto" src={logo} alt={name} />
</div>
</div>
<div className="sm:flex sm:items-center">
<div className="text-left">
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-white">
{name}
</h3>
<p className="mt-2 text-xs text-gray-500 dark:text-gray-400">
{description}
</p>
</div>
</div>
</div>
</Link>
);
};
136 changes: 31 additions & 105 deletions app/ui/src/components/Bot/Integration/IntegrationGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Modal } from "antd";
import React from "react";
import { IntegrationForm } from "./IntegrationForm";
import { Link, useParams } from "react-router-dom";
import { useDarkMode } from "../../../hooks/useDarkmode";
import { useParams } from "react-router-dom";
import { IntegrationCard } from "./IntegrationCard";

type Props = {
data: {
Expand Down Expand Up @@ -56,7 +56,6 @@ export const IntegrationGrid: React.FC<Props> = ({ data }) => {
textColor: string;
} | null>();
const param = useParams<{ id: string }>();
const { mode } = useDarkMode();
return (
<div className="px-4 sm:px-6 lg:px-8">
<div className="sm:flex sm:items-center">
Expand All @@ -72,110 +71,37 @@ export const IntegrationGrid: React.FC<Props> = ({ data }) => {
{/* GRID */}
<div className="mt-8 grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
{data.map((integration) => (
<div className="relative group bg-white p-6 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-500 rounded-lg overflow-hidden border hover:shadow-lg transition-shadow duration-300 ease-in-out cursor-pointer dark:bg-[#0a0a0a] dark:border-[#232222] dark:hover:bg-[#1a1a1a] dark:hover:border-[#232222] hover:bg-gray-50">
<div
onClick={() => {
setSelectedIntegration(integration);
setOpen(true);
}}
>
<div className="mb-4">
<div className="flex items-center justify-between">
<img
className="h-12 w-auto"
src={integration.logo}
alt={integration.name}
/>
<div className="ml-2 flex flex-shrink-0">
<p
className={`inline-flex rounded-md px-2 text-sm leading-5 border border-transparent uppercase tracking-widest dark:bg-[#232222] dark:text-[#fff] dark:border-[#232222] dark:hover:bg-[#232222] dark:hover:text-[#fff] dark:hover:border-[#232222]
`}
style={{
backgroundColor:
mode !== "dark" ? integration.color : undefined,
color:
mode !== "dark" ? integration.textColor : undefined,
borderColor:
mode !== "dark"
? integration.color !== "#fff"
? integration.color
: "#000"
: undefined,
}}
>
{integration.status}
</p>
</div>
</div>
</div>
<div className="sm:flex sm:items-center">
<div className="text-center sm:text-left">
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-white">
{integration.name}
</h3>
<p className="mt-2 text-xs text-gray-500 dark:text-gray-400">
{integration.description}
</p>
</div>
</div>
</div>
</div>
<IntegrationCard
onClick={() => {
setSelectedIntegration(integration);
setOpen(true);
}}
logo={integration.logo}
name={integration.name}
color={integration.color}
textColor={integration.textColor}
status={integration.status}
description={integration.description}
/>
))}

<Link
to={`/bot/${param.id}/embed`}
className="relative group bg-white p-6 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-500 rounded-lg overflow-hidden border hover:shadow-lg transition-shadow duration-300 ease-in-out cursor-pointer dark:bg-[#0a0a0a] dark:border-[#232222] dark:hover:bg-[#1a1a1a] dark:hover:border-[#232222] hover:bg-gray-50"
>
<div>
<div className="mb-4">
<div className="flex items-center justify-between">
<img
className="h-12 w-auto"
src="/providers/html.svg"
alt="HTML"
/>
</div>
</div>
<div className="sm:flex sm:items-center">
<div className="text-center sm:text-left">
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-white">
HTML Embed
</h3>
<p className="mt-2 text-xs text-gray-500 dark:text-gray-400">
Embed your chatbot on your website or blog using HTML snippet.
</p>
</div>
</div>
</div>
</Link>

<Link
to={`/bot/${param.id}/integrations/api`}
className="relative group bg-white p-6 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-500 rounded-lg overflow-hidden border hover:shadow-lg transition-shadow duration-300 ease-in-out cursor-pointer dark:bg-[#0a0a0a] dark:border-[#232222] dark:hover:bg-[#1a1a1a] dark:hover:border-[#232222] hover:bg-gray-50"
>
<div>
<div className="mb-4">
<div className="flex items-center justify-between">
<img
className="h-12 w-auto"
src="/providers/api.svg"
alt="API"
/>
</div>
</div>
<div className="sm:flex sm:items-center">
<div className="text-center sm:text-left">
<h3 className="text-lg leading-6 font-medium text-gray-900 dark:text-white">
API
</h3>
<p className="mt-2 text-xs text-gray-500 dark:text-gray-400">
Customize your integration using our robust API. Connect and
expand the capabilities of your chatbot across platforms.
</p>
</div>
</div>
</div>
</Link>
<IntegrationCard
href={`/bot/${param.id}/embed`}
logo="/providers/html.svg"
name="HTML Embed"
color="#fff"
textColor="#000"
description="Embed your chatbot on your website or blog using HTML snippet."
/>

<IntegrationCard
href={`/bot/${param.id}/integrations/api`}
logo="/providers/api.svg"
name="API"
color="#fff"
textColor="#000"
description="Customize your integration using our robust API. Connect and expand the capabilities of your chatbot across platforms."
/>
</div>

{/* MODAL */}
Expand Down
12 changes: 10 additions & 2 deletions app/ui/src/components/Common/BotForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,10 @@ export const BotForm = ({
<Select
showSearch
filterOption={(input, option) =>
(option?.label ? option?.label?.toLowerCase() : "").includes(
(option?.label?.toLowerCase() ?? "").includes(
input?.toLowerCase()
) ||
(option?.value?.toLowerCase() ?? "").includes(
input?.toLowerCase()
)
}
Expand All @@ -574,7 +577,12 @@ export const BotForm = ({
<Select
showSearch
filterOption={(input, option) =>
(option?.label ?? "").includes(input)
(option?.label?.toLowerCase() ?? "").includes(
input?.toLowerCase()
) ||
(option?.value?.toLowerCase() ?? "").includes(
input?.toLowerCase()
)
}
filterSort={(optionA, optionB) =>
(optionA?.label ?? "")
Expand Down
2 changes: 1 addition & 1 deletion app/ui/src/components/Dashboard/DashboardGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const DashboardGrid = () => {
<Empty description="No bots created yet" />
)}
{status === "success" && data.length > 0 && (
<div className="grid grid-cols-1 mt-6 gap-4 sm:grid-cols-3">
<div className="grid grid-cols-1 mt-6 gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
{data.map((bot: any) => (
<Link
to={`/bot/${bot.id}`}
Expand Down
5 changes: 4 additions & 1 deletion app/ui/src/routes/settings/model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export default function SettingsModelRoot() {
}}
initialValues={{
api_type: "openai",
ollama_url: "http://localhost:11434",
ollama_url: "http://host.docker.internal:11434",
}}
>
{apiType === "openai" && (
Expand Down Expand Up @@ -712,6 +712,9 @@ export default function SettingsModelRoot() {
}}
form={embeddingForm}
layout="vertical"
initialValues={{
url: "http://host.docker.internal:11434",
}}
>
<Form.Item
name="url"
Expand Down
19 changes: 9 additions & 10 deletions docs/guide/self-hosting-railway.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Here are the steps to get a Railway instance of the dialoqbase server up and run
Dialoqbase use nice amount of memory. So, make sure you add credit limit to your Railway account.
:::

In case any issue related to Railway, you can check out this thread on GitHub: [#203](https://github.com/n4ze3m/dialoqbase/issues/203)


## Prerequisites

Expand All @@ -25,13 +27,12 @@ Just click on the button below to deploy the template on Railway.

You need to provide the following environment variables:

- `OPENAI_API_KEY`
- `DATABASE_URL`


You can skip the rest of the steps by watching the video below.
<!-- You can skip the rest of the steps by watching the video below -->

<video src="https://video.twimg.com/ext_tw_video/1668206930240864256/pu/vid/1354x720/vL4jyYEHTANSaxpF.mp4" controls="controls" style="width: 100%;"></video>
<!-- <video src="https://video.twimg.com/ext_tw_video/1668206930240864256/pu/vid/1354x720/vL4jyYEHTANSaxpF.mp4" controls="controls" style="width: 100%;"></video> -->

### Setting up a Supabase Database

Expand All @@ -48,28 +49,26 @@ You need to remember the password you provide to the project 😁.

#### 2. Copy the URL

:::warning
You must use `Session Mode` instead of `Connection Pool` otherwise the server will not work properly.
:::

Once the project is created, next step is to get the database URL.

1. Click on the cog icon on the left sidebar.

2. Click on the `Database` from project settings sidebar.

3. Scroll down to the `Connection String` section and select the `Node.js` tab.
3. Select `Session Mode` instead of `Connection Pool` and Select `Node.js` as the URL format.

4. Copy the `DATABASE_URL` and replace `[YOUR-PASSWORD]` with the password you provided to the project.

5. Paste the `DATABASE_URL` in the railway environment variables.



That's it! You have successfully setup the database.


### Setting up the OpenAI API Key

Just copy paste your `OPENAI_API_KEY` in the railway environment variables.


### Launch the server

After setting up the database and the OpenAI API Key, you can now launch the server by clicking `Deploy` button. This may take a few minutes to deploy the server be patient.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dialoqbase",
"version": "1.7.1",
"version": "1.7.2",
"description": "Create chatbots with ease",
"scripts": {
"ui:dev": "pnpm run --filter ui dev",
Expand Down
Loading

0 comments on commit ad9baf6

Please sign in to comment.