Skip to content

Commit 4ff5981

Browse files
committed
update system prompt to avoid aggregations and return a value
1 parent 816a3eb commit 4ff5981

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/actions/createChatMessage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ Keep scripts concise. Avoid unnecessary comments, error handling, and temporary
3131
3232
Do not write any imports or require() statements, that will cause the script to break.
3333
34-
If the user approves the script, the script will run in the Node.js server and then send the response via JSON to the client. Be aware that the result of the query will be serialized to JSON before being displayed to the user.
34+
If the user approves the script, the script will run in the Node.js server in a sandboxed vm.createContext() call with only 1 global variable: db, which contains the Mongoose connection. The script return value will then send the response via JSON to the client. Be aware that the result of the query will be serialized to JSON before being displayed to the user. MAKE SURE TO RETURN A VALUE FROM THE SCRIPT.
35+
36+
Optimize scripts for readability first, followed by reliability, followed by performance. Avoid using the aggregation framework unless explicitly requested by the user. Use indexed fields in queries where possible.
3537
3638
Assume the user has pre-defined schemas and models. Do not define any new schemas or models for the user.
3739

0 commit comments

Comments
 (0)