@mongoosejs/studio 0.0.87 → 0.0.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -55,7 +55,7 @@ return { numUsers: users.length };
|
|
|
55
55
|
Here is a description of the user's models. Assume these are the only models available in the system unless explicitly instructed otherwise by the user.
|
|
56
56
|
`.trim();
|
|
57
57
|
|
|
58
|
-
module.exports = ({ db, studioConnection }) => async function createChatMessage(params) {
|
|
58
|
+
module.exports = ({ db, studioConnection, options }) => async function createChatMessage(params) {
|
|
59
59
|
const { chatThreadId, userId, content, script, authorization } = new CreateChatMessageParams(params);
|
|
60
60
|
const ChatThread = studioConnection.model('__Studio_ChatThread');
|
|
61
61
|
const ChatMessage = studioConnection.model('__Studio_ChatMessage');
|
|
@@ -91,6 +91,12 @@ module.exports = ({ db, studioConnection }) => async function createChatMessage(
|
|
|
91
91
|
role: 'system',
|
|
92
92
|
content: systemPrompt + getModelDescriptions(db)
|
|
93
93
|
});
|
|
94
|
+
if (options.context) {
|
|
95
|
+
llmMessages.unshift({
|
|
96
|
+
role: 'system',
|
|
97
|
+
content: context
|
|
98
|
+
});
|
|
99
|
+
}
|
|
94
100
|
|
|
95
101
|
// Create the chat message and get OpenAI response in parallel
|
|
96
102
|
const chatMessages = await Promise.all([
|
|
@@ -111,7 +117,7 @@ module.exports = ({ db, studioConnection }) => async function createChatMessage(
|
|
|
111
117
|
})
|
|
112
118
|
]);
|
|
113
119
|
|
|
114
|
-
return { chatMessages };
|
|
120
|
+
return { chatMessages, chatThread };
|
|
115
121
|
};
|
|
116
122
|
|
|
117
123
|
async function getChatCompletion(messages, authorization) {
|
package/backend/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const chatMessageSchema = require('./db/chatMessageSchema');
|
|
|
8
8
|
const chatThreadSchema = require('./db/chatThreadSchema');
|
|
9
9
|
const dashboardSchema = require('./db/dashboardSchema');
|
|
10
10
|
|
|
11
|
-
module.exports = function backend(db, studioConnection) {
|
|
11
|
+
module.exports = function backend(db, studioConnection, options) {
|
|
12
12
|
db = db || mongoose.connection;
|
|
13
13
|
|
|
14
14
|
studioConnection = studioConnection ?? db;
|
|
@@ -16,6 +16,6 @@ module.exports = function backend(db, studioConnection) {
|
|
|
16
16
|
const ChatMessage = studioConnection.model('__Studio_ChatMessage', chatMessageSchema, 'studio__chatMessages');
|
|
17
17
|
const ChatThread = studioConnection.model('__Studio_ChatThread', chatThreadSchema, 'studio__chatThreads');
|
|
18
18
|
|
|
19
|
-
const actions = applySpec(Actions, { db, studioConnection });
|
|
19
|
+
const actions = applySpec(Actions, { db, studioConnection, options });
|
|
20
20
|
return actions;
|
|
21
21
|
};
|
package/backend/netlify.js
CHANGED
|
@@ -4,7 +4,7 @@ const Backend = require('./');
|
|
|
4
4
|
const { toNetlifyFunction } = require('extrovert');
|
|
5
5
|
|
|
6
6
|
module.exports = function netlify(conn, options) {
|
|
7
|
-
const backend = Backend(conn, options?.studioConnection);
|
|
7
|
+
const backend = Backend(conn, options?.studioConnection, options);
|
|
8
8
|
const mothershipUrl = options?._mothershipUrl || 'https://mongoose-js.netlify.app/.netlify/functions';
|
|
9
9
|
|
|
10
10
|
let workspace = null;
|
package/express.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongoosejs/studio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.88",
|
|
4
4
|
"description": "A sleek, powerful MongoDB UI with built-in dashboarding and auth, seamlessly integrated with your Express, Vercel, or Netlify app.",
|
|
5
5
|
"homepage": "https://studio.mongoosejs.io/",
|
|
6
6
|
"repository": {
|