Skip to content

Commit 2ca257d

Browse files
authored
⚙️ fix: minor issues related to agents (danny-avila#4297)
* chore: deprecate `web-browser` tool * fix: edit agent permission
1 parent 2ce8647 commit 2ca257d

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

api/app/clients/tools/util/handleTools.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
const { Tools } = require('librechat-data-provider');
22
const { ZapierToolKit } = require('langchain/agents');
33
const { Calculator } = require('langchain/tools/calculator');
4-
const { WebBrowser } = require('langchain/tools/webbrowser');
54
const { SerpAPI, ZapierNLAWrapper } = require('langchain/tools');
6-
const { OpenAIEmbeddings } = require('langchain/embeddings/openai');
75
const { createCodeExecutionTool, EnvVar } = require('@librechat/agents');
86
const { getUserPluginAuthValue } = require('~/server/services/PluginService');
97
const {
@@ -31,12 +29,6 @@ const { loadToolSuite } = require('./loadToolSuite');
3129
const { loadSpecs } = require('./loadSpecs');
3230
const { logger } = require('~/config');
3331

34-
const getOpenAIKey = async (options, user) => {
35-
let openAIApiKey = options.openAIApiKey ?? process.env.OPENAI_API_KEY;
36-
openAIApiKey = openAIApiKey === 'user_provided' ? null : openAIApiKey;
37-
return openAIApiKey || (await getUserPluginAuthValue(user, 'OPENAI_API_KEY'));
38-
};
39-
4032
/**
4133
* Validates the availability and authentication of tools for a user based on environment variables or user-specific plugin authentication values.
4234
* Tools without required authentication or with valid authentication are considered valid.
@@ -177,8 +169,6 @@ const loadTools = async ({
177169
traversaal_search: TraversaalSearch,
178170
};
179171

180-
const openAIApiKey = await getOpenAIKey(options, user);
181-
182172
const customConstructors = {
183173
e2b_code_interpreter: async () => {
184174
if (!functions) {
@@ -191,7 +181,6 @@ const loadTools = async ({
191181
user,
192182
options: {
193183
model,
194-
openAIApiKey,
195184
...options,
196185
},
197186
});
@@ -208,14 +197,6 @@ const loadTools = async ({
208197
options,
209198
});
210199
},
211-
'web-browser': async () => {
212-
// let openAIApiKey = options.openAIApiKey ?? process.env.OPENAI_API_KEY;
213-
// openAIApiKey = openAIApiKey === 'user_provided' ? null : openAIApiKey;
214-
// openAIApiKey = openAIApiKey || (await getUserPluginAuthValue(user, 'OPENAI_API_KEY'));
215-
const browser = new WebBrowser({ model, embeddings: new OpenAIEmbeddings({ openAIApiKey }) });
216-
browser.description_for_model = browser.description;
217-
return browser;
218-
},
219200
serpapi: async () => {
220201
let apiKey = process.env.SERPAPI_API_KEY;
221202
if (!apiKey) {

client/src/components/SidePanel/Agents/AgentPanel.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,25 @@ export default function AgentPanel({
174174
}
175175
}, [agent_id, onSelectAgent]);
176176

177+
const canEditAgent = useMemo(() => {
178+
const canEdit =
179+
agentQuery.data?.isCollaborative ?? false
180+
? true
181+
: agentQuery.data?.author === user?.id || user?.role === SystemRoles.ADMIN;
182+
183+
return agentQuery.data?.id != null && agentQuery.data.id ? canEdit : true;
184+
}, [
185+
agentQuery.data?.isCollaborative,
186+
agentQuery.data?.author,
187+
agentQuery.data?.id,
188+
user?.id,
189+
user?.role,
190+
]);
191+
177192
if (agentQuery.isInitialLoading) {
178193
return <AgentPanelSkeleton />;
179194
}
180195

181-
const canEditAgent =
182-
agentQuery.data?.isCollaborative ?? false
183-
? true
184-
: agentQuery.data?.author === user?.id || user?.role === SystemRoles.ADMIN;
185-
186196
return (
187197
<FormProvider {...methods}>
188198
<form

0 commit comments

Comments
 (0)