mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 12:29:41 +02:00
Warn users of gpu-sensitive operation (#2488)
* warn users of gpu-sensitive operation * update copy
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
import React, { Dispatch, forwardRef, SetStateAction, useState } from "react";
|
||||
import React, {
|
||||
Dispatch,
|
||||
forwardRef,
|
||||
SetStateAction,
|
||||
useContext,
|
||||
useState,
|
||||
} from "react";
|
||||
import { Formik, Form, FormikProps } from "formik";
|
||||
import * as Yup from "yup";
|
||||
import {
|
||||
RerankerProvider,
|
||||
RerankingDetails,
|
||||
RerankingModel,
|
||||
rerankingModels,
|
||||
} from "./interfaces";
|
||||
import { FiExternalLink } from "react-icons/fi";
|
||||
@@ -15,6 +22,7 @@ import {
|
||||
import { Modal } from "@/components/Modal";
|
||||
import { Button } from "@tremor/react";
|
||||
import { TextFormField } from "@/components/admin/connectors/Field";
|
||||
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
||||
|
||||
interface RerankingDetailsFormProps {
|
||||
setRerankingDetails: Dispatch<SetStateAction<RerankingDetails>>;
|
||||
@@ -38,10 +46,15 @@ const RerankingDetailsForm = forwardRef<
|
||||
},
|
||||
ref
|
||||
) => {
|
||||
const [showGpuWarningModalModel, setShowGpuWarningModalModel] =
|
||||
useState<RerankingModel | null>(null);
|
||||
const [isApiKeyModalOpen, setIsApiKeyModalOpen] = useState(false);
|
||||
const [showLiteLLMConfigurationModal, setShowLiteLLMConfigurationModal] =
|
||||
useState(false);
|
||||
|
||||
const combinedSettings = useContext(SettingsContext);
|
||||
const gpuEnabled = combinedSettings?.settings.gpu_enabled;
|
||||
|
||||
return (
|
||||
<Formik
|
||||
innerRef={ref}
|
||||
@@ -169,6 +182,11 @@ const RerankingDetailsForm = forwardRef<
|
||||
RerankerProvider.LITELLM
|
||||
) {
|
||||
setShowLiteLLMConfigurationModal(true);
|
||||
} else if (
|
||||
!card.rerank_provider_type &&
|
||||
!gpuEnabled
|
||||
) {
|
||||
setShowGpuWarningModalModel(card);
|
||||
}
|
||||
|
||||
if (!isSelected) {
|
||||
@@ -225,6 +243,33 @@ const RerankingDetailsForm = forwardRef<
|
||||
})}
|
||||
</div>
|
||||
|
||||
{showGpuWarningModalModel && (
|
||||
<Modal
|
||||
onOutsideClick={() => setShowGpuWarningModalModel(null)}
|
||||
width="w-[500px] flex flex-col"
|
||||
title="GPU Not Enabled"
|
||||
>
|
||||
<>
|
||||
<p className="text-error font-semibold">Warning:</p>
|
||||
<p>
|
||||
Local reranking models require significant computational
|
||||
resources and may perform slowly without GPU
|
||||
acceleration. Consider switching to GPU-enabled
|
||||
infrastructure or using a cloud-based alternative for
|
||||
better performance.
|
||||
</p>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
onClick={() => setShowGpuWarningModalModel(null)}
|
||||
color="blue"
|
||||
size="xs"
|
||||
>
|
||||
Understood
|
||||
</Button>
|
||||
</div>
|
||||
</>
|
||||
</Modal>
|
||||
)}
|
||||
{showLiteLLMConfigurationModal && (
|
||||
<Modal
|
||||
onOutsideClick={() => {
|
||||
|
@@ -5,6 +5,7 @@ export interface Settings {
|
||||
maximum_chat_retention_days: number | null;
|
||||
notifications: Notification[];
|
||||
needs_reindexing: boolean;
|
||||
gpu_enabled: boolean;
|
||||
}
|
||||
|
||||
export interface Notification {
|
||||
|
@@ -42,6 +42,7 @@ export async function fetchSettingsSS(): Promise<CombinedSettings | null> {
|
||||
if (!results[0].ok) {
|
||||
if (results[0].status === 403) {
|
||||
settings = {
|
||||
gpu_enabled: false,
|
||||
chat_page_enabled: true,
|
||||
search_page_enabled: true,
|
||||
default_page: "search",
|
||||
|
Reference in New Issue
Block a user