|
|
@@ -7,6 +7,7 @@ import {
|
|
|
Mezmo,
|
|
|
Newrelic,
|
|
|
Postgres,
|
|
|
+ Quivr,
|
|
|
Redis,
|
|
|
Tailscale,
|
|
|
} from "@porter-dev/api-contracts/src/porter/v1/addons_pb";
|
|
|
@@ -20,6 +21,7 @@ import { metabaseConfigValidator } from "./metabase";
|
|
|
import { mezmoConfigValidator } from "./mezmo";
|
|
|
import { newrelicConfigValidator } from "./newrelic";
|
|
|
import { defaultPostgresAddon, postgresConfigValidator } from "./postgres";
|
|
|
+import { quivrConfigValidator } from "./quivr";
|
|
|
import { redisConfigValidator } from "./redis";
|
|
|
import { tailscaleConfigValidator } from "./tailscale";
|
|
|
import {
|
|
|
@@ -28,6 +30,7 @@ import {
|
|
|
ADDON_TEMPLATE_MEZMO,
|
|
|
ADDON_TEMPLATE_NEWRELIC,
|
|
|
ADDON_TEMPLATE_POSTGRES,
|
|
|
+ ADDON_TEMPLATE_QUIVR,
|
|
|
ADDON_TEMPLATE_REDIS,
|
|
|
ADDON_TEMPLATE_TAILSCALE,
|
|
|
type AddonTemplate,
|
|
|
@@ -55,6 +58,7 @@ export const clientAddonValidator = z.object({
|
|
|
metabaseConfigValidator,
|
|
|
newrelicConfigValidator,
|
|
|
tailscaleConfigValidator,
|
|
|
+ quivrConfigValidator,
|
|
|
]),
|
|
|
});
|
|
|
export type ClientAddonType = z.infer<
|
|
|
@@ -153,6 +157,16 @@ export function defaultClientAddon(
|
|
|
}),
|
|
|
template: ADDON_TEMPLATE_TAILSCALE,
|
|
|
}))
|
|
|
+ .with("quivr", () => ({
|
|
|
+ ...clientAddonValidator.parse({
|
|
|
+ expanded: true,
|
|
|
+ name: { readOnly: false, value: "quivr" },
|
|
|
+ config: quivrConfigValidator.parse({
|
|
|
+ type: "quivr",
|
|
|
+ }),
|
|
|
+ }),
|
|
|
+ template: ADDON_TEMPLATE_QUIVR,
|
|
|
+ }))
|
|
|
.exhaustive();
|
|
|
}
|
|
|
|
|
|
@@ -165,6 +179,7 @@ function addonTypeEnumProto(type: ClientAddon["config"]["type"]): AddonType {
|
|
|
.with("metabase", () => AddonType.METABASE)
|
|
|
.with("newrelic", () => AddonType.NEWRELIC)
|
|
|
.with("tailscale", () => AddonType.TAILSCALE)
|
|
|
+ .with("quivr", () => AddonType.QUIVR)
|
|
|
.exhaustive();
|
|
|
}
|
|
|
|
|
|
@@ -254,6 +269,31 @@ export function clientAddonToProto(
|
|
|
}),
|
|
|
case: "tailscale" as const,
|
|
|
}))
|
|
|
+ .with({ type: "quivr" }, (data) => ({
|
|
|
+ value: new Quivr({
|
|
|
+ ingressEnabled: data.exposedToExternalTraffic,
|
|
|
+ domains: [
|
|
|
+ {
|
|
|
+ name: data.customDomain,
|
|
|
+ type: DomainType.UNSPECIFIED,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: data.porterDomain,
|
|
|
+ type: DomainType.PORTER,
|
|
|
+ },
|
|
|
+ // if not exposed, remove all domains
|
|
|
+ ].filter((d) => d.name !== "" && data.exposedToExternalTraffic),
|
|
|
+ openaiApiKey: data.openAiApiKey,
|
|
|
+ supabaseUrl: data.supabaseUrl,
|
|
|
+ supabaseServiceKey: data.supabaseServiceKey,
|
|
|
+ pgDatabaseUrl: data.pgDatabaseUrl,
|
|
|
+ jwtSecretKey: data.jwtSecretKey,
|
|
|
+ quivrDomain: data.quivrDomain,
|
|
|
+ anthropicApiKey: data.anthropicApiKey,
|
|
|
+ cohereApiKey: data.cohereApiKey,
|
|
|
+ }),
|
|
|
+ case: "quivr" as const,
|
|
|
+ }))
|
|
|
.exhaustive();
|
|
|
|
|
|
const proto = new Addon({
|
|
|
@@ -365,6 +405,25 @@ export function clientAddonFromProto({
|
|
|
authKey: data.value.authKey ?? "",
|
|
|
subnetRoutes: data.value.subnetRoutes.map((r) => ({ route: r })),
|
|
|
}))
|
|
|
+ .with({ case: "quivr" }, (data) => ({
|
|
|
+ type: "quivr" as const,
|
|
|
+ exposedToExternalTraffic: data.value.ingressEnabled ?? false,
|
|
|
+ porterDomain:
|
|
|
+ data.value.domains.find((domain) => domain.type === DomainType.PORTER)
|
|
|
+ ?.name ?? "",
|
|
|
+ customDomain:
|
|
|
+ data.value.domains.find(
|
|
|
+ (domain) => domain.type === DomainType.UNSPECIFIED
|
|
|
+ )?.name ?? "",
|
|
|
+ openAiApiKey: data.value.openaiApiKey ?? "",
|
|
|
+ supabaseUrl: data.value.supabaseUrl ?? "",
|
|
|
+ supabaseServiceKey: data.value.supabaseServiceKey ?? "",
|
|
|
+ pgDatabaseUrl: data.value.pgDatabaseUrl ?? "",
|
|
|
+ jwtSecretKey: data.value.jwtSecretKey ?? "",
|
|
|
+ quivrDomain: data.value.quivrDomain ?? "",
|
|
|
+ anthropicApiKey: data.value.anthropicApiKey ?? "",
|
|
|
+ cohereApiKey: data.value.cohereApiKey ?? "",
|
|
|
+ }))
|
|
|
.exhaustive();
|
|
|
|
|
|
const template = match(addon.config)
|
|
|
@@ -375,6 +434,7 @@ export function clientAddonFromProto({
|
|
|
.with({ case: "metabase" }, () => ADDON_TEMPLATE_METABASE)
|
|
|
.with({ case: "newrelic" }, () => ADDON_TEMPLATE_NEWRELIC)
|
|
|
.with({ case: "tailscale" }, () => ADDON_TEMPLATE_TAILSCALE)
|
|
|
+ .with({ case: "quivr" }, () => ADDON_TEMPLATE_QUIVR)
|
|
|
.exhaustive();
|
|
|
|
|
|
const clientAddon = {
|