-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
76 changed files
with
1,903 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ | |
"streamable", | ||
"textgenwebui", | ||
"togetherai", | ||
"fireworksai", | ||
"Unembed", | ||
"vectordbs", | ||
"Weaviate", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
frontend/src/components/LLMSelection/FireworksAiOptions/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import System from "@/models/system"; | ||
import { useState, useEffect } from "react"; | ||
|
||
export default function FireworksAiOptions({ settings }) { | ||
return ( | ||
<div className="flex gap-[36px] mt-1.5"> | ||
<div className="flex flex-col w-60"> | ||
<label className="text-white text-sm font-semibold block mb-3"> | ||
Fireworks AI API Key | ||
</label> | ||
<input | ||
type="password" | ||
name="FireworksAiLLMApiKey" | ||
className="border-none bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5" | ||
placeholder="Fireworks AI API Key" | ||
defaultValue={settings?.FireworksAiLLMApiKey ? "*".repeat(20) : ""} | ||
required={true} | ||
autoComplete="off" | ||
spellCheck={false} | ||
/> | ||
</div> | ||
{!settings?.credentialsOnly && ( | ||
<FireworksAiModelSelection settings={settings} /> | ||
)} | ||
</div> | ||
); | ||
} | ||
function FireworksAiModelSelection({ settings }) { | ||
const [groupedModels, setGroupedModels] = useState({}); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
async function findCustomModels() { | ||
setLoading(true); | ||
const { models } = await System.customModels("fireworksai"); | ||
|
||
if (models?.length > 0) { | ||
const modelsByOrganization = models.reduce((acc, model) => { | ||
acc[model.organization] = acc[model.organization] || []; | ||
acc[model.organization].push(model); | ||
return acc; | ||
}, {}); | ||
|
||
setGroupedModels(modelsByOrganization); | ||
} | ||
|
||
setLoading(false); | ||
} | ||
findCustomModels(); | ||
}, []); | ||
|
||
if (loading || Object.keys(groupedModels).length === 0) { | ||
return ( | ||
<div className="flex flex-col w-60"> | ||
<label className="text-white text-sm font-semibold block mb-3"> | ||
Chat Model Selection | ||
</label> | ||
<select | ||
name="FireworksAiLLMModelPref" | ||
disabled={true} | ||
className="border-none bg-zinc-900 border-gray-500 text-white text-sm rounded-lg block w-full p-2.5" | ||
> | ||
<option disabled={true} selected={true}> | ||
-- loading available models -- | ||
</option> | ||
</select> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col w-60"> | ||
<label className="text-white text-sm font-semibold block mb-3"> | ||
Chat Model Selection | ||
</label> | ||
<select | ||
name="FireworksAiLLMModelPref" | ||
required={true} | ||
className="border-none bg-zinc-900 border-gray-500 text-white text-sm rounded-lg block w-full p-2.5" | ||
> | ||
{Object.keys(groupedModels) | ||
.sort() | ||
.map((organization) => ( | ||
<optgroup key={organization} label={organization}> | ||
{groupedModels[organization].map((model) => ( | ||
<option | ||
key={model.id} | ||
value={model.id} | ||
selected={settings?.FireworksAiLLMModelPref === model.id} | ||
> | ||
{model.name} | ||
</option> | ||
))} | ||
</optgroup> | ||
))} | ||
</select> | ||
</div> | ||
); | ||
} |
79 changes: 79 additions & 0 deletions
79
frontend/src/components/Modals/ManageWorkspace/Documents/Directory/ContextMenu/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { useRef, useEffect } from "react"; | ||
|
||
export default function ContextMenu({ | ||
contextMenu, | ||
closeContextMenu, | ||
files, | ||
selectedItems, | ||
setSelectedItems, | ||
}) { | ||
const contextMenuRef = useRef(null); | ||
|
||
useEffect(() => { | ||
const handleClickOutside = (event) => { | ||
if ( | ||
contextMenuRef.current && | ||
!contextMenuRef.current.contains(event.target) | ||
) { | ||
closeContextMenu(); | ||
} | ||
}; | ||
|
||
document.addEventListener("mousedown", handleClickOutside); | ||
return () => { | ||
document.removeEventListener("mousedown", handleClickOutside); | ||
}; | ||
}, [closeContextMenu]); | ||
|
||
const isAllSelected = () => { | ||
const allItems = files.items.flatMap((folder) => [ | ||
folder.name, | ||
...folder.items.map((file) => file.id), | ||
]); | ||
return allItems.every((item) => selectedItems[item]); | ||
}; | ||
|
||
const toggleSelectAll = () => { | ||
if (isAllSelected()) { | ||
setSelectedItems({}); | ||
} else { | ||
const newSelectedItems = {}; | ||
files.items.forEach((folder) => { | ||
newSelectedItems[folder.name] = true; | ||
folder.items.forEach((file) => { | ||
newSelectedItems[file.id] = true; | ||
}); | ||
}); | ||
setSelectedItems(newSelectedItems); | ||
} | ||
closeContextMenu(); | ||
}; | ||
|
||
if (!contextMenu.visible) return null; | ||
|
||
return ( | ||
<div | ||
ref={contextMenuRef} | ||
style={{ | ||
position: "fixed", | ||
top: `${contextMenu.y}px`, | ||
left: `${contextMenu.x}px`, | ||
zIndex: 1000, | ||
}} | ||
className="bg-zinc-800 border border-zinc-700 rounded-md shadow-lg" | ||
> | ||
<button | ||
onClick={toggleSelectAll} | ||
className="block w-full text-left px-4 py-2 text-sm text-white hover:bg-zinc-700" | ||
> | ||
{isAllSelected() ? "Unselect All" : "Select All"} | ||
</button> | ||
<button | ||
onClick={closeContextMenu} | ||
className="block w-full text-left px-4 py-2 text-sm text-white hover:bg-zinc-700" | ||
> | ||
Cancel | ||
</button> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.