Skip to content

Commit

Permalink
add ai model manager to initial settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
samlhuillier committed Dec 12, 2023
1 parent adcd77b commit a283410
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
16 changes: 8 additions & 8 deletions electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ import { validateAIModelConfig } from "./llm/llmConfig";
import { registerStoreHandlers } from "./Store/storeHandlers";

const store = new Store<StoreSchema>();
// const user = store.get("user");
const user = store.get("user");
// store.clear();

// // Check if 'user' and 'directory' exist before attempting to delete
// if (user && typeof user === "object" && "directory" in user) {
// // Delete the 'directory' property
// delete user.directory;
// Check if 'user' and 'directory' exist before attempting to delete
if (user && typeof user === "object" && "directory" in user) {
// Delete the 'directory' property
delete user.directory;

// // Save the updated 'user' object back to the store
// store.set("user", user);
// }
// Save the updated 'user' object back to the store
store.set("user", user);
}

process.env.DIST_ELECTRON = join(__dirname, "../");
process.env.DIST = join(process.env.DIST_ELECTRON, "../dist");
Expand Down
18 changes: 10 additions & 8 deletions src/components/Settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import Modal from "../Generic/Modal";
import { Button } from "@material-tailwind/react";
import AIModelManager from "./LLMSettings";

interface Props {
onDirectorySelected: (path: string) => void;
Expand Down Expand Up @@ -63,8 +64,8 @@ const DirectoryPicker: React.FC<Props> = ({ onDirectorySelected }) => {
onClose={() => console.log("Not allowing a close for now")}
hideCloseButton={true}
>
<div className="">
<div className="ml-2 mr-6 mt-0 h-full ">
<div className="w-full mr-3">
<div className="ml-2 mt-0 h-full ">
<h2 className="text-2xl font-semibold mb-0 text-white">
Welcome to the Reor Project.
</h2>
Expand All @@ -89,31 +90,32 @@ const DirectoryPicker: React.FC<Props> = ({ onDirectorySelected }) => {
<h4 className="font-semibold mb-2 text-white">Embedding Model</h4>
<input
type="text"
className="block w-[470px] px-3 py-2 mr-2 border border-gray-300 rounded-md bg-gray-200 cursor-not-allowed"
className="block w-full box-border px-3 py-2 mr-2 border border-gray-300 rounded-md bg-gray-200 cursor-not-allowed"
value={"BAAI/bge-base-en-v1.5"}
disabled
placeholder="Embedding Model Name"
/>
<h4 className="font-semibold mb-2 text-white">LLM</h4>
<AIModelManager />
{/* <h4 className="font-semibold mb-2 text-white">LLM</h4>
<input
type="text"
className="block w-[470px] px-3 py-2 border border-gray-300 rounded-md bg-gray-200 cursor-not-allowed"
className="block w-full px-3 py-2 box-border border border-gray-300 rounded-md bg-gray-200 cursor-not-allowed"
value={"GPT-3.5-turbo"}
disabled
placeholder="LLM Model Name"
/>
/> */}
<h4 className="font-semibold mb-2 text-white">Open AI Key</h4>
<input
type="text"
className="block w-[470px] px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out"
className="block w-full px-3 py-2 box-border border border-gray-300 rounded-md focus:outline-none focus:shadow-outline-blue focus:border-blue-300 transition duration-150 ease-in-out"
value={openAIKey}
onChange={(e) => setOpenAIKey(e.target.value)}
onKeyDown={handleKeyPress}
placeholder="Open AI API Key"
/>

<Button
className="bg-slate-700 mt-6 border-none h-10 hover:bg-slate-900 cursor-pointer w-[80px] text-center pt-0 pb-0 pr-2 pl-2"
className="bg-slate-700 mt-6 mb-3 border-none h-10 hover:bg-slate-900 cursor-pointer w-[80px] text-center pt-0 pb-0 pr-2 pl-2"
onClick={handleNext}
placeholder=""
>
Expand Down

0 comments on commit a283410

Please sign in to comment.