Skip to content

Commit df7cac3

Browse files
authored
🤖 fix: Azure Agents after Upstream Breaking Change (danny-avila#5571)
* 🤖 fix: Azure Agents after Upstream Breaking Change * chore: bump @langchain/core & @librechat/agents * fix: correct formatting in assistant actions update logic and use correctly filtered actions variable * fix: linting errors
1 parent 3f0c466 commit df7cac3

File tree

7 files changed

+48
-471
lines changed

7 files changed

+48
-471
lines changed

api/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@
4040
"@keyv/mongo": "^2.1.8",
4141
"@keyv/redis": "^2.8.1",
4242
"@langchain/community": "^0.3.14",
43-
"@langchain/core": "^0.3.18",
43+
"@langchain/core": "^0.3.37",
4444
"@langchain/google-genai": "^0.1.7",
4545
"@langchain/google-vertexai": "^0.1.8",
4646
"@langchain/textsplitters": "^0.1.0",
47-
"@librechat/agents": "^1.9.98",
47+
"@librechat/agents": "^2.0.0",
4848
"@waylaidwanderer/fetch-event-source": "^3.0.1",
4949
"axios": "^1.7.7",
5050
"bcryptjs": "^2.4.3",

api/server/routes/assistants/actions.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,7 @@ router.post('/:assistant_id', async (req, res) => {
105105
if (!assistant_data) {
106106
assistantUpdateData.user = req.user.id;
107107
}
108-
promises.push(
109-
updateAssistantDoc(
110-
{ assistant_id },
111-
assistantUpdateData,
112-
)
113-
);
108+
promises.push(updateAssistantDoc({ assistant_id }, assistantUpdateData));
114109

115110
// Only update user field for new actions
116111
const actionUpdateData = { metadata, assistant_id };
@@ -191,16 +186,11 @@ router.delete('/:assistant_id/:action_id/:model', async (req, res) => {
191186

192187
const promises = [];
193188
// Only update user field if assistant document doesn't exist
194-
const assistantUpdateData = { actions };
189+
const assistantUpdateData = { actions: updatedActions };
195190
if (!assistant_data) {
196191
assistantUpdateData.user = req.user.id;
197192
}
198-
promises.push(
199-
updateAssistantDoc(
200-
{ assistant_id },
201-
assistantUpdateData,
202-
),
203-
);
193+
promises.push(updateAssistantDoc({ assistant_id }, assistantUpdateData));
204194
promises.push(deleteAction({ action_id }));
205195

206196
await Promise.all(promises);

config/list-users.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
const path = require('path');
22
require('module-alias')({ base: path.resolve(__dirname, '..', 'api') });
3-
const { askQuestion, silentExit } = require('./helpers');
43
const connect = require('./connect');
54
const User = require('../api/models/User');
65

76
const listUsers = async () => {
87
try {
98
await connect();
109
const users = await User.find({}, 'email provider avatar username name createdAt');
11-
10+
1211
console.log('\nUser List:');
1312
console.log('----------------------------------------');
14-
users.forEach(user => {
13+
users.forEach((user) => {
1514
console.log(`Email: ${user.email}`);
1615
console.log(`Username: ${user.username || 'N/A'}`);
1716
console.log(`Name: ${user.name || 'N/A'}`);
1817
console.log(`Provider: ${user.provider || 'email'}`);
1918
console.log(`Created: ${user.createdAt}`);
2019
console.log('----------------------------------------');
2120
});
22-
21+
2322
console.log(`\nTotal Users: ${users.length}`);
2423
process.exit(0);
2524
} catch (err) {
@@ -28,4 +27,4 @@ const listUsers = async () => {
2827
}
2928
};
3029

31-
listUsers();
30+
listUsers();

config/reset-password.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,57 @@
11
const path = require('path');
2-
require('module-alias')({ base: path.resolve(__dirname, '..', 'api') });
3-
const { askQuestion, silentExit } = require('./helpers');
4-
const connect = require('./connect');
5-
const User = require('../api/models/User');
62
const bcrypt = require('bcryptjs');
73
const readline = require('readline');
4+
require('module-alias')({ base: path.resolve(__dirname, '..', 'api') });
5+
const User = require('../api/models/User');
6+
const connect = require('./connect');
87

98
const rl = readline.createInterface({
109
input: process.stdin,
11-
output: process.stdout
10+
output: process.stdout,
1211
});
1312

1413
const question = (query) => new Promise((resolve) => rl.question(query, resolve));
1514

1615
const resetPassword = async () => {
1716
try {
1817
await connect();
19-
18+
2019
const email = await question('Enter user email: ');
2120
const user = await User.findOne({ email });
22-
21+
2322
if (!user) {
2423
console.error('User not found!');
2524
process.exit(1);
2625
}
2726

2827
let validPassword = false;
2928
let newPassword;
30-
29+
3130
while (!validPassword) {
3231
newPassword = await question('Enter new password: ');
3332
if (newPassword.length < 8) {
34-
console.log('Password must be at least 8 characters! Please try again.');
35-
continue;
33+
console.log('Password must be at least 8 characters! Please try again.');
34+
continue;
3635
}
3736

3837
const confirmPassword = await question('Confirm new password: ');
3938
if (newPassword !== confirmPassword) {
40-
console.log('Passwords do not match! Please try again.');
41-
continue;
39+
console.log('Passwords do not match! Please try again.');
40+
continue;
4241
}
43-
42+
4443
validPassword = true;
4544
}
4645

4746
const salt = await bcrypt.genSalt(10);
4847
const hashedPassword = await bcrypt.hash(newPassword, salt);
49-
48+
5049
await User.updateOne(
5150
{ email },
52-
{
51+
{
5352
password: hashedPassword,
54-
passwordVersion: Date.now() // Invalidate old sessions
55-
}
53+
passwordVersion: Date.now(), // Invalidate old sessions
54+
},
5655
);
5756

5857
console.log('Password successfully reset!');
@@ -65,4 +64,4 @@ const resetPassword = async () => {
6564
}
6665
};
6766

68-
resetPassword();
67+
resetPassword();

0 commit comments

Comments
 (0)