Skip to content
16 changes: 16 additions & 0 deletions Parse-Dashboard/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = (options) => {
const configUserPassword = options.userPassword || process.env.PARSE_DASHBOARD_USER_PASSWORD;
const configSSLKey = options.sslKey || process.env.PARSE_DASHBOARD_SSL_KEY;
const configSSLCert = options.sslCert || process.env.PARSE_DASHBOARD_SSL_CERT;
const configAgent = options.agent || process.env.PARSE_DASHBOARD_AGENT_CONFIG;

function handleSIGs(server) {
const signals = {
Expand Down Expand Up @@ -83,6 +84,21 @@ module.exports = (options) => {
}
];
}
// Add agent configuration from environment variables
if (configAgent) {
// If it's already an object (from JS config), use it directly
if (typeof configAgent === 'object') {
configFromCLI.data.agent = configAgent;
} else {
// Otherwise, try to parse it as JSON
try {
configFromCLI.data.agent = JSON.parse(configAgent);
} catch (error) {
console.error('Failed to parse PARSE_DASHBOARD_AGENT_CONFIG:', error.message);
process.exit(1);
}
}
}
} else if (!configServerURL && !configMasterKey && !configAppName) {
configFile = path.join(__dirname, 'parse-dashboard-config.json');
}
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ PARSE_DASHBOARD_SSL_KEY: "sslKey"
PARSE_DASHBOARD_SSL_CERT: "sslCert"
PARSE_DASHBOARD_CONFIG: undefined // Only for reference, it must not exist
PARSE_DASHBOARD_COOKIE_SESSION_SECRET: undefined // set the cookie session secret, defaults to a random string. Use this option if you want sessions to work across multiple servers, or across restarts
PARSE_DASHBOARD_AGENT_CONFIG: undefined // JSON string containing the full agent configuration with models array

```

Expand Down Expand Up @@ -1294,14 +1295,20 @@ To configure the AI agent for your dashboard, you need to add the `agent` config
}
```

| Parameter | Type | Required | Description |
|-----------------------------|--------|----------|--------------------------------------------------------------------------------|
| `agent` | Object | Yes | The AI agent configuration object. |
| `agent.models` | Array | Yes | Array of AI model configurations available to the agent. |
| Parameter | Type | Required | Description |
|-----------------------------|--------|----------|--------------------------------------------------------------------------|
| `agent` | Object | Yes | The AI agent configuration object. |
| `agent.models` | Array | Yes | Array of AI model configurations available to the agent. |
| `agent.models[*].name` | String | Yes | The display name for the model (e.g., `ChatGPT 4.1`). |
| `agent.models[*].provider` | String | Yes | The AI provider identifier (e.g., "openai"). |
| `agent.models[*].model` | String | Yes | The specific model name from the provider (e.g., `gpt-4.1`). |
| `agent.models[*].apiKey` | String | Yes | The API key for authenticating with the AI provider. |
| `agent.models[*].provider` | String | Yes | The AI provider identifier (e.g., "openai"). |
| `agent.models[*].model` | String | Yes | The specific model name from the provider (e.g., `gpt-4.1`). |
| `agent.models[*].apiKey` | String | Yes | The API key for authenticating with the AI provider. |

> [!Note]
> The agent configuration can also be set via the `PARSE_DASHBOARD_AGENT_CONFIG` environment variable. Provide the complete agent configuration as a JSON string:
> ```bash
> PARSE_DASHBOARD_AGENT_CONFIG='{"models":[{"name":"ChatGPT 4.1","provider":"openai","model":"gpt-4.1","apiKey":"YOUR_API_KEY"}]}'
> ```

The agent will use the configured models to process natural language commands and perform database operations using the master key from your app configuration.

Expand Down