mirror of
https://github.com/prowler-cloud/prowler.git
synced 2025-12-19 05:17:47 +00:00
Co-authored-by: Chandrapal Badshah <12944530+Chan9390@users.noreply.github.com> Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com> Co-authored-by: Alejandro Bailo <59607668+alejandrobailo@users.noreply.github.com> Co-authored-by: Alan Buscaglia <gentlemanprogramming@gmail.com> Co-authored-by: Adrián Jesús Peña Rodríguez <adrianjpr@gmail.com> Co-authored-by: Andoni Alonso <14891798+andoniaf@users.noreply.github.com> Co-authored-by: Rubén De la Torre Vico <ruben@prowler.com> Co-authored-by: Daniel Barranquero <danielbo2001@gmail.com>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { redirect } from "next/navigation";
|
|
|
|
import {
|
|
getLighthouseProvidersConfig,
|
|
isLighthouseConfigured,
|
|
} from "@/actions/lighthouse/lighthouse";
|
|
import { LighthouseIcon } from "@/components/icons/Icons";
|
|
import { Chat } from "@/components/lighthouse";
|
|
import { ContentLayout } from "@/components/ui";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export default async function AIChatbot() {
|
|
const hasConfig = await isLighthouseConfigured();
|
|
|
|
if (!hasConfig) {
|
|
return redirect("/lighthouse/config");
|
|
}
|
|
|
|
// Fetch provider configuration with default models
|
|
const providersConfig = await getLighthouseProvidersConfig();
|
|
|
|
// Handle errors or missing configuration
|
|
if (providersConfig.errors || !providersConfig.providers) {
|
|
return redirect("/lighthouse/config");
|
|
}
|
|
|
|
return (
|
|
<ContentLayout title="Lighthouse AI" icon={<LighthouseIcon />}>
|
|
<div className="-mx-6 -my-4 h-[calc(100dvh-4.5rem)] sm:-mx-8">
|
|
<Chat
|
|
hasConfig={hasConfig}
|
|
providers={providersConfig.providers}
|
|
defaultProviderId={providersConfig.defaultProviderId}
|
|
defaultModelId={providersConfig.defaultModelId}
|
|
/>
|
|
</div>
|
|
</ContentLayout>
|
|
);
|
|
}
|