From 0ff7b1b0f1768fbff29cb6958942f11cdfad8635 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Thu, 26 Dec 2024 18:56:22 +0545 Subject: [PATCH 1/2] feat: new connections for LLMS * fix icon for google cloud storage & GCP --- .../Connections/ConnectionFormModal.tsx | 1 + .../Connections/connectionTypes.tsx | 131 ++++++++++++++++++ src/ui/Icons/Icon.tsx | 8 +- 3 files changed, 138 insertions(+), 2 deletions(-) diff --git a/src/components/Connections/ConnectionFormModal.tsx b/src/components/Connections/ConnectionFormModal.tsx index edf303444..e88286f71 100644 --- a/src/components/Connections/ConnectionFormModal.tsx +++ b/src/components/Connections/ConnectionFormModal.tsx @@ -15,6 +15,7 @@ import { export type Connection = { altID?: string; authMethod?: string; + model?: string; bucket?: string; certificate?: string; channel?: string; diff --git a/src/components/Connections/connectionTypes.tsx b/src/components/Connections/connectionTypes.tsx index 3e0a8df14..5f4981b28 100644 --- a/src/components/Connections/connectionTypes.tsx +++ b/src/components/Connections/connectionTypes.tsx @@ -47,6 +47,9 @@ export type ConnectionFormFields = { }; export const enum ConnectionValueType { + Anthropic = "anthropic", + Ollama = "ollama", + OpenAI = "openai", AWS = "aws", AWS_S3 = "s3", Azure = "azure", @@ -123,6 +126,134 @@ export const commonConnectionFormFields: ConnectionFormFields[] = [ ]; export const connectionTypes: ConnectionType[] = [ + { + title: "Anthropic", + icon: "anthropic", + value: ConnectionValueType.Anthropic, + fields: [ + ...commonConnectionFormFields, + { + label: "Model", + key: "model", + type: ConnectionsFieldTypes.input, + required: false + }, + { + label: "Base URL", + hint: "appropriate when using a proxy", + key: "url", + type: ConnectionsFieldTypes.EnvVarSource, + required: false + }, + { + label: "API Key", + key: "password", + type: ConnectionsFieldTypes.EnvVarSource, + required: true + } + ], + convertToFormSpecificValue: (data: Record) => { + return { + ...data, + model: data?.properties?.model + } as Connection; + }, + preSubmitConverter: (data: Record) => { + return { + name: data.name, + url: data.url, + password: data.password, + properties: { + model: data.model + } + }; + } + }, + { + title: "OpenAI", + icon: "openai", + value: ConnectionValueType.OpenAI, + fields: [ + ...commonConnectionFormFields, + { + label: "URL", + key: "url", + hint: "appropriate when using a proxy", + type: ConnectionsFieldTypes.input, + required: false + }, + { + label: "Model", + key: "model", + type: ConnectionsFieldTypes.EnvVarSource, + required: false + }, + { + label: "API Key", + key: "password", + type: ConnectionsFieldTypes.EnvVarSource, + required: true + } + ], + convertToFormSpecificValue: (data: Record) => { + return { + ...data, + model: data?.properties?.model + } as Connection; + }, + preSubmitConverter: (data: Record) => { + return { + name: data.name, + url: data.url, + password: data.password, + properties: { + model: data.model + } + }; + } + }, + { + title: "Ollama", + icon: "ollama", + value: ConnectionValueType.Ollama, + fields: [ + ...commonConnectionFormFields, + { + label: "URL", + key: "url", + type: ConnectionsFieldTypes.input, + required: true + }, + { + label: "Model", + key: "model", + type: ConnectionsFieldTypes.EnvVarSource, + required: false + }, + { + label: "API Key", + key: "password", + type: ConnectionsFieldTypes.EnvVarSource, + required: true + } + ], + convertToFormSpecificValue: (data: Record) => { + return { + ...data, + model: data?.properties?.model + } as Connection; + }, + preSubmitConverter: (data: Record) => { + return { + name: data.name, + url: data.url, + password: data.password, + properties: { + model: data.model + } + }; + } + }, { title: "Postgres", icon: "postgres", diff --git a/src/ui/Icons/Icon.tsx b/src/ui/Icons/Icon.tsx index b99107a32..8a4c57620 100644 --- a/src/ui/Icons/Icon.tsx +++ b/src/ui/Icons/Icon.tsx @@ -4,6 +4,9 @@ import { isEmpty } from "lodash"; type IconMap = Record; export const aliases: IconMap = { + anthropic: "anthropic", + openai: "openai", + ollama: "ollama", aws_s3: "aws-s3", kubernetes_resource: "k8s", generic_webhook: "webhook", @@ -115,7 +118,9 @@ export const aliases: IconMap = { "elasticloadbalancing-loadbalancer": "aws-elb", fluentbit: "fluentd", "google chat": "google-chat", - "google cloud": "gcp", + "google cloud": "google-cloud", + google_cloud: "google-cloud", + gcs: "google-cloud", "iam-instanceprofile": "server", "iam-role": "shield", "iam-user": "user", @@ -142,7 +147,6 @@ export const aliases: IconMap = { "k8s-servicemonitor": "prometheus", "k8s-tigerastatus": "calico", "k8s-topology": "mission-control", - gcs: "gcsbucket", kubernetes: "k8s", "mssql-database": "sqlserver", mssql: "sqlserver", From ac4af38280f5f1ca0787c1a43ad185073ca4cee2 Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Fri, 27 Dec 2024 15:25:09 +0545 Subject: [PATCH 2/2] bump icons --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 97e2de6d3..645c378b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,12 +6,12 @@ "packages": { "": { "name": "@flanksource/flanksource-ui", - "version": "1.0.830", + "version": "1.0.831", "dependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@clerk/nextjs": "^5.3.0", "@dagrejs/dagre": "^1.1.1", - "@flanksource/icons": "^1.0.31", + "@flanksource/icons": "^1.0.32", "@floating-ui/react": "^0.26.9", "@headlessui/react": "^2.1.2", "@heroicons/react": "^1.0.3", @@ -3384,9 +3384,9 @@ "dev": true }, "node_modules/@flanksource/icons": { - "version": "1.0.31", - "resolved": "https://registry.npmjs.org/@flanksource/icons/-/icons-1.0.31.tgz", - "integrity": "sha512-Qi0N72RWcUCXjRllPD6YUxeXbND1+Cs+5ZrmWRmjveYc4cWHo9QUsKzapUGowj7p9HPdKZGSXsQZCZOvmHktWQ==", + "version": "1.0.32", + "resolved": "https://registry.npmjs.org/@flanksource/icons/-/icons-1.0.32.tgz", + "integrity": "sha512-0f6P+CBzcc90O16KUuPDeie1PBg91teeusFaXBLK+Dl+G9Hb4iF7mvkjnHSXy/daABY51Vh5H++GhDHl4Ni7NQ==", "peerDependencies": { "react": "*" } diff --git a/package.json b/package.json index ee7cc7fc2..6c1d5ea1f 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "@clerk/nextjs": "^5.3.0", "@dagrejs/dagre": "^1.1.1", - "@flanksource/icons": "^1.0.31", + "@flanksource/icons": "^1.0.32", "@floating-ui/react": "^0.26.9", "@headlessui/react": "^2.1.2", "@heroicons/react": "^1.0.3",