From 3dbc9eaa1f985e1b17d429ebff063e626855489d Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Mon, 23 Oct 2023 23:03:30 +0530 Subject: [PATCH 01/15] test new github action --- .github/workflows/next.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index 73506a7a..6dd3fd2b 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -10,19 +10,24 @@ jobs: steps: - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PWD }} - name: Build and push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: + context: . + file: ./Dockerfile + platforms: | + linux/amd64 + linux/arm64 tags: | n4z3m/dialoqbase-next:latest push: true \ No newline at end of file From bf0ac4677fdb5847a8933ccf9bea73b46f888553 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Mon, 23 Oct 2023 23:05:37 +0530 Subject: [PATCH 02/15] build --- .github/workflows/next.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index 6dd3fd2b..9f786a5c 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -23,8 +23,6 @@ jobs: - name: Build and push uses: docker/build-push-action@v5 with: - context: . - file: ./Dockerfile platforms: | linux/amd64 linux/arm64 From 0b01bf6f81bc16899d47f4118b8a93ceb4e0074b Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Mon, 23 Oct 2023 23:43:15 +0530 Subject: [PATCH 03/15] build --- .github/workflows/next.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index 9f786a5c..a6fbea06 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -8,14 +8,13 @@ jobs: docker: runs-on: ubuntu-latest steps: - - - name: Set up QEMU + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -23,9 +22,8 @@ jobs: - name: Build and push uses: docker/build-push-action@v5 with: - platforms: | - linux/amd64 - linux/arm64 + context: . + platforms: linux/amd64,linux/arm64 tags: | n4z3m/dialoqbase-next:latest push: true \ No newline at end of file From ffa58f607ab054cedb90c1bcb6f721306629f54c Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Tue, 24 Oct 2023 00:24:08 +0530 Subject: [PATCH 04/15] use cache --- .github/workflows/next.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index a6fbea06..1c157f11 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -26,4 +26,6 @@ jobs: platforms: linux/amd64,linux/arm64 tags: | n4z3m/dialoqbase-next:latest - push: true \ No newline at end of file + push: true + cache-from: type=registry,ref=n4z3m/dialoqbase-next:latest + cache-to: type=inline \ No newline at end of file From 2fc1d45b538ea6ed73bcbd2aefbfbde165dbaeb6 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Tue, 24 Oct 2023 22:56:25 +0530 Subject: [PATCH 05/15] be normal --- .github/workflows/build.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d820494c..757cb562 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,22 +9,25 @@ jobs: docker: runs-on: ubuntu-latest steps: - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Docker Hub - uses: docker/login-action@v2 + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PWD }} - name: Build and push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: + context: . + platforms: linux/amd64,linux/arm64 tags: | n4z3m/dialoqbase:latest n4z3m/dialoqbase:${{ github.ref_name}} push: true + cache-from: type=registry,ref=n4z3m/dialoqbase:latest + cache-to: type=inline From e14b5bd80399c1797275f12c4cbcc7cae365bdd6 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Tue, 24 Oct 2023 22:56:31 +0530 Subject: [PATCH 06/15] be normal --- .github/workflows/build.yml | 2 -- .github/workflows/next.yml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 757cb562..bb5c7b91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,8 +23,6 @@ jobs: - name: Build and push uses: docker/build-push-action@v5 with: - context: . - platforms: linux/amd64,linux/arm64 tags: | n4z3m/dialoqbase:latest n4z3m/dialoqbase:${{ github.ref_name}} diff --git a/.github/workflows/next.yml b/.github/workflows/next.yml index 1c157f11..c08894d0 100644 --- a/.github/workflows/next.yml +++ b/.github/workflows/next.yml @@ -22,8 +22,6 @@ jobs: - name: Build and push uses: docker/build-push-action@v5 with: - context: . - platforms: linux/amd64,linux/arm64 tags: | n4z3m/dialoqbase-next:latest push: true From 235eea2f916780ee883cdfb55c1c17e7d9d6d454 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Thu, 2 Nov 2023 11:39:51 +0530 Subject: [PATCH 07/15] Add configuration for OpenAI API URL in chatModelProvider function --- server/src/utils/models.ts | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/server/src/utils/models.ts b/server/src/utils/models.ts index b4182370..f3aab729 100644 --- a/server/src/utils/models.ts +++ b/server/src/utils/models.ts @@ -16,7 +16,6 @@ export const chatModelProvider = ( console.log("provider", provider); console.log("modelName", modelName); - switch (provider.toLowerCase()) { case "openai": console.log("using openai"); @@ -24,6 +23,9 @@ export const chatModelProvider = ( modelName: modelName, temperature: temperature, ...otherFields, + configuration: { + baseURL: process.env.OPENAI_API_URL, + }, }); case "anthropic": console.log("using anthropic"); @@ -59,6 +61,9 @@ export const chatModelProvider = ( modelName: modelName, temperature: temperature, ...otherFields, + configuration: { + baseURL: process.env.OPENAI_API_URL, + }, }); case "local": console.log("using local"); @@ -80,28 +85,6 @@ export const chatModelProvider = ( } }; -export const huggingfaceModels: { - [key: string]: string; -} = { - "falcon-7b-instruct-inference": "tiiuae/falcon-7b-instruct", -}; - -export const fireworksModels: { - [key: string]: string; -} = { - "llama-v2-7b-chat": "accounts/fireworks/models/llama-v2-7b-chat", - "llama-v2-13b-chat": "accounts/fireworks/models/llama-v2-13b-chat", - "llama-v2-70b-chat": "accounts/fireworks/models/llama-v2-70b-chat", - "llama-v2-7b-chat-w8a16": "accounts/fireworks/models/llama-v2-7b-chat-w8a16", - "llama-v2-13b-chat-w8a16": - "accounts/fireworks/models/llama-v2-13b-chat-w8a16", - "llama-v2-13b-code-instruct": - "accounts/fireworks/models/llama-v2-13b-code-instruct", - "llama-v2-34b-code-instruct-w8a16": - "accounts/fireworks/models/llama-v2-34b-code-instruct-w8a16", - "mistral-7b-instruct-4k": "accounts/fireworks/models/mistral-7b-instruct-4k", -}; - export const streamingSupportedModels = [ "gpt-3.5-turbo", "gpt-3.5-turbo-16k", From 6d4ee437940e33fd0bfc42059ffd34b96c619056 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Thu, 2 Nov 2023 11:42:28 +0530 Subject: [PATCH 08/15] Add error logging to registerUserHandler --- server/src/routes/api/v1/user/handlers/post.handler.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/routes/api/v1/user/handlers/post.handler.ts b/server/src/routes/api/v1/user/handlers/post.handler.ts index 6f2578d0..ebabd83d 100644 --- a/server/src/routes/api/v1/user/handlers/post.handler.ts +++ b/server/src/routes/api/v1/user/handlers/post.handler.ts @@ -224,6 +224,7 @@ export const registerUserHandler = async ( to: "/", }); } catch (e) { + console.log(e); return reply.status(500).send({ message: "Error registering user", }); From b62f382c9db9e151003d29b5317b26a7b0833206 Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Thu, 2 Nov 2023 11:42:48 +0530 Subject: [PATCH 09/15] Update version numbers and add api_config field to User model --- app/ui/package.json | 2 +- package.json | 2 +- server/prisma/migrations/q_17/migration.sql | 2 ++ server/prisma/schema.prisma | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 server/prisma/migrations/q_17/migration.sql diff --git a/app/ui/package.json b/app/ui/package.json index f635292e..0c341779 100644 --- a/app/ui/package.json +++ b/app/ui/package.json @@ -1,7 +1,7 @@ { "name": "app", "private": true, - "version": "1.2.1", + "version": "1.3.0", "type": "module", "scripts": { "dev": "vite", diff --git a/package.json b/package.json index fb2f2f4e..70487a92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dialoqbase", - "version": "1.2.1", + "version": "1.3.0", "description": "Create chatbots with ease", "scripts": { "ui:dev": "pnpm run --filter ui dev", diff --git a/server/prisma/migrations/q_17/migration.sql b/server/prisma/migrations/q_17/migration.sql new file mode 100644 index 00000000..280d9936 --- /dev/null +++ b/server/prisma/migrations/q_17/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "User" ADD COLUMN "api_config" JSON DEFAULT '{"OPENAI_API_KEY": null, "ANTHROPIC_API_KEY": null, "GOOGLE_API_KEY": null, "COHERE_API_KEY": null, "FIREWORKS_API_KEY": null}'; diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma index c3505377..582d7cf1 100644 --- a/server/prisma/schema.prisma +++ b/server/prisma/schema.prisma @@ -75,6 +75,7 @@ model User { email String? @unique isFirstLogin Boolean @default(true) isAdministrator Boolean @default(false) + api_config Json? @default("{\"OPENAI_API_KEY\": null, \"ANTHROPIC_API_KEY\": null, \"GOOGLE_API_KEY\": null, \"COHERE_API_KEY\": null, \"FIREWORKS_API_KEY\": null}") @db.Json createdAt DateTime @default(now()) bots Bot[] } From 714dfcd7a8f3d768c491a332eadf37e37707ddbd Mon Sep 17 00:00:00 2001 From: n4ze3m Date: Thu, 2 Nov 2023 12:15:30 +0530 Subject: [PATCH 10/15] Add API key to model fetch request and save it in model configuration --- app/ui/src/routes/settings/model.tsx | 9 +++++++++ .../api/v1/admin/handlers/model.handler.ts | 18 +++++++++++++----- .../src/routes/api/v1/admin/handlers/type.ts | 2 ++ server/src/utils/models.ts | 5 +++++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/app/ui/src/routes/settings/model.tsx b/app/ui/src/routes/settings/model.tsx index 24eff6a3..05478ea8 100644 --- a/app/ui/src/routes/settings/model.tsx +++ b/app/ui/src/routes/settings/model.tsx @@ -75,6 +75,7 @@ export default function SettingsModelRoot() { const response = await api.post("/admin/models", { ...values, url: fetchUrlForm.getFieldValue("url"), + api_key: fetchUrlForm.getFieldValue("api_key"), }); return response.data; }; @@ -311,6 +312,14 @@ export default function SettingsModelRoot() { /> + + + +