mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-18 16:11:45 +03:00
d955e31f50
added explore button and removed unused feature openai key # Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
/* eslint-disable max-lines */
|
|
"use client";
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
import { FaCopy } from "react-icons/fa";
|
|
|
|
import Button from "@/lib/components/ui/Button";
|
|
import Field from "@/lib/components/ui/Field";
|
|
|
|
import { useApiKeyConfig } from "./hooks/useApiKeyConfig";
|
|
|
|
export const ApiKeyConfig = (): JSX.Element => {
|
|
const {
|
|
apiKey,
|
|
handleCopyClick,
|
|
handleCreateClick,
|
|
|
|
} = useApiKeyConfig();
|
|
const { t } = useTranslation(["config"]);
|
|
|
|
return (
|
|
<>
|
|
<h3 className="font-semibold mb-2">Quivr {t("apiKey")}</h3>
|
|
|
|
<div>
|
|
{apiKey === "" ? (
|
|
<Button
|
|
data-testid="create-new-key"
|
|
variant="secondary"
|
|
onClick={() => void handleCreateClick()}
|
|
>
|
|
Create New Key
|
|
</Button>
|
|
) : (
|
|
<div className="flex items-center space-x-2">
|
|
<Field name="quivrApiKey" disabled={true} value={apiKey} />
|
|
<button data-testid="copy-api-key-button" onClick={handleCopyClick}>
|
|
<FaCopy />
|
|
</button>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
</>
|
|
);
|
|
};
|