这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ import useGetProviderModels, {
DISABLED_PROVIDERS,
} from "@/hooks/useGetProvidersModels";

// These models do NOT support function calling
function supportedModel(provider, model = "") {
if (provider !== "openai") return true;
if (model.startsWith("gpt-3.5-turbo")) return true;
switch (model) {
case "gpt-4":
case "gpt-4-turbo-preview":
case "gpt-4-32k":
return true;
default:
return false;
}
}

export default function AgentModelSelection({
provider,
workspace,
Expand Down Expand Up @@ -60,6 +74,7 @@ export default function AgentModelSelection({
{defaultModels.length > 0 && (
<optgroup label="General models">
{defaultModels.map((model) => {
if (!supportedModel(provider, model)) return null;
return (
<option
key={model}
Expand All @@ -75,6 +90,8 @@ export default function AgentModelSelection({
{Array.isArray(customModels) && customModels.length > 0 && (
<optgroup label="Custom models">
{customModels.map((model) => {
if (!supportedModel(provider, model.id)) return null;

return (
<option
key={model.id}
Expand All @@ -93,15 +110,18 @@ export default function AgentModelSelection({
<>
{Object.entries(customModels).map(([organization, models]) => (
<optgroup key={organization} label={organization}>
{models.map((model) => (
<option
key={model.id}
value={model.id}
selected={workspace?.agentModel === model.id}
>
{model.name}
</option>
))}
{models.map((model) => {
if (!supportedModel(provider, model.id)) return null;
return (
<option
key={model.id}
value={model.id}
selected={workspace?.agentModel === model.id}
>
{model.name}
</option>
);
})}
</optgroup>
))}
</>
Expand Down
164 changes: 82 additions & 82 deletions frontend/src/pages/WorkspaceSettings/AgentConfig/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,92 +112,92 @@ export default function WorkspaceAgentConfiguration({ workspace }) {
</form>
</div>
);
}

function LoadingSkeleton() {
return (
<div id="workspace-agent-settings-container">
<div className="w-1/2 flex flex-col gap-y-6">
<Skeleton.default
height={100}
width="100%"
count={2}
baseColor="#292524"
highlightColor="#4c4948"
enableAnimation={true}
containerClassName="flex flex-col gap-y-1"
/>
<div className="bg-white/10 h-[1px] w-full" />
<Skeleton.default
height={100}
width="100%"
count={2}
baseColor="#292524"
highlightColor="#4c4948"
enableAnimation={true}
containerClassName="flex flex-col gap-y-1 mt-4"
/>
</div>
function LoadingSkeleton() {
return (
<div id="workspace-agent-settings-container">
<div className="w-1/2 flex flex-col gap-y-6">
<Skeleton.default
height={100}
width="100%"
count={2}
baseColor="#292524"
highlightColor="#4c4948"
enableAnimation={true}
containerClassName="flex flex-col gap-y-1"
/>
<div className="bg-white/10 h-[1px] w-full" />
<Skeleton.default
height={100}
width="100%"
count={2}
baseColor="#292524"
highlightColor="#4c4948"
enableAnimation={true}
containerClassName="flex flex-col gap-y-1 mt-4"
/>
</div>
);
}
</div>
);
}

function AvailableAgentSkills({ skills, settings, toggleAgentSkill }) {
return (
<div>
<div className="flex flex-col mb-8">
<div className="flex w-full justify-between items-center">
<label htmlFor="name" className="text-white text-md font-semibold">
Default agent skills
</label>
</div>
<p className="text-white text-opacity-60 text-xs font-medium py-1.5">
Improve the natural abilities of the default agent with these
pre-built skills. This set up applies to all workspaces.
</p>
function AvailableAgentSkills({ skills, settings, toggleAgentSkill }) {
return (
<div>
<div className="flex flex-col mb-8">
<div className="flex w-full justify-between items-center">
<label htmlFor="name" className="text-white text-md font-semibold">
Default agent skills
</label>
</div>
<input
name="system::default_agent_skills"
type="hidden"
value={skills.join(",")}
<p className="text-white text-opacity-60 text-xs font-medium py-1.5">
Improve the natural abilities of the default agent with these
pre-built skills. This set up applies to all workspaces.
</p>
</div>
<input
name="system::default_agent_skills"
type="hidden"
value={skills.join(",")}
/>
<div className="flex flex-col gap-y-3">
<GenericSkill
title="RAG & long-term memory"
description='Allow the agent to leverage your local documents to answer a query or ask the agent to "remember" pieces of content for long-term memory retrieval.'
settings={settings}
enabled={true}
disabled={true}
/>
<GenericSkill
title="View and summarize documents"
description="Allow the agent to list and summarize the content of workspace files currently embedded."
settings={settings}
enabled={true}
disabled={true}
/>
<GenericSkill
title="Scrape websites"
description="Allow the agent to visit and scrape the content of websites."
settings={settings}
enabled={true}
disabled={true}
/>
<GenericSkill
title="Generate & save files to browser"
description="Enable the default agent to generate and write to files that save and can be downloaded in your browser."
skill="save-file-to-browser"
settings={settings}
toggleSkill={toggleAgentSkill}
enabled={skills.includes("save-file-to-browser")}
/>
<AgentWebSearchSelection
skill="web-browsing"
settings={settings}
toggleSkill={toggleAgentSkill}
enabled={skills.includes("web-browsing")}
/>
<div className="flex flex-col gap-y-3">
<GenericSkill
title="RAG & long-term memory"
description='Allow the agent to leverage your local documents to answer a query or ask the agent to "remember" pieces of content for long-term memory retrieval.'
settings={settings}
enabled={true}
disabled={true}
/>
<GenericSkill
title="View and summarize documents"
description="Allow the agent to list and summarize the content of workspace files currently embedded."
settings={settings}
enabled={true}
disabled={true}
/>
<GenericSkill
title="Scrape websites"
description="Allow the agent to visit and scrape the content of websites."
settings={settings}
enabled={true}
disabled={true}
/>
<GenericSkill
title="Generate & save files to browser"
description="Enable the default agent to generate and write to files that save and can be downloaded in your browser."
skill="save-file-to-browser"
settings={settings}
toggleSkill={toggleAgentSkill}
enabled={skills.includes("save-file-to-browser")}
/>
<AgentWebSearchSelection
skill="web-browsing"
settings={settings}
toggleSkill={toggleAgentSkill}
enabled={skills.includes("web-browsing")}
/>
</div>
</div>
);
}
</div>
);
}
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"node-html-markdown": "^1.3.0",
"node-llama-cpp": "^2.8.0",
"openai": "^3.2.1",
"openai:latest": "npm:openai@latest",
"openai-latest": "npm:openai@latest",
"pinecone-client": "^1.1.0",
"pluralize": "^8.0.0",
"posthog-node": "^3.1.1",
Expand Down Expand Up @@ -84,4 +84,4 @@
"nodemon": "^2.0.22",
"prettier": "^3.0.3"
}
}
}
2 changes: 1 addition & 1 deletion server/utils/agents/aibitat/providers/openai.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const OpenAI = require("openai:latest");
const OpenAI = require("openai-latest");
const Provider = require("./ai-provider.js");
const { RetryError } = require("../error.js");

Expand Down
8 changes: 4 additions & 4 deletions server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4495,10 +4495,10 @@ onnxruntime-web@1.14.0:
onnxruntime-common "~1.14.0"
platform "^1.3.6"

"openai:latest@npm:openai@latest":
version "4.32.1"
resolved "https://registry.yarnpkg.com/openai/-/openai-4.32.1.tgz#9e375fdbc727330c5ea5d287beb325db3e6f9ad7"
integrity sha512-3e9QyCY47tgOkxBe2CSVKlXOE2lLkMa24Y0s3LYZR40yYjiBU9dtVze+C3mu1TwWDGiRX52STpQAEJZvRNuIrA==
"openai-latest@npm:openai@latest":
version "4.38.0"
resolved "https://registry.yarnpkg.com/openai/-/openai-4.38.0.tgz#d97accc7c368670a40c2f668650b624cb941dc8b"
integrity sha512-q1w04cRm+7CgUAGDXqt+OMa89zXBffHrEK0FcVDRhD+zL1S1aAatu4iYO5sIxR2QFEP//i8CM3QaxGVTNajxuw==
dependencies:
"@types/node" "^18.11.18"
"@types/node-fetch" "^2.6.4"
Expand Down