diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml
index 34e0aee1ae..2f77d1d0c7 100644
--- a/app/views/install/compose.phtml
+++ b/app/views/install/compose.phtml
@@ -11,6 +11,7 @@ $httpsPort = $this->getParam('httpsPort', '');
$version = $this->getParam('version', '');
$organization = $this->getParam('organization', '');
$image = $this->getParam('image', '');
+$enableAssistant = $this->getParam('enableAssistant', false);
?>services:
traefik:
image: traefik:2.11
@@ -848,6 +849,7 @@ $image = $this->getParam('image', '');
- _APP_DB_USER
- _APP_DB_PASS
+
appwrite-assistant:
image: appwrite/assistant:0.8.4
container_name: appwrite-assistant
@@ -857,6 +859,7 @@ $image = $this->getParam('image', '');
- appwrite
environment:
- _APP_ASSISTANT_OPENAI_API_KEY
+
appwrite-browser:
image: appwrite/browser:0.3.2
diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php
index b210a020b9..1173a8ce27 100644
--- a/src/Appwrite/Platform/Tasks/Install.php
+++ b/src/Appwrite/Platform/Tasks/Install.php
@@ -148,11 +148,44 @@ class Install extends Action
$httpsPort = ($httpsPort) ? $httpsPort : $defaultHTTPSPort;
}
+ $enableAssistant = false;
+ if ($interactive == 'Y' && Console::isInteractive()) {
+ $answer = Console::confirm('Add Appwrite Assistant? (Y/n)');
+ $enableAssistant = !empty($answer) && \strtolower($answer) === 'y';
+ }
+
$input = [];
$password = new Password();
$token = new Token();
foreach ($vars as $var) {
+ if ($var['name'] === '_APP_ASSISTANT_OPENAI_API_KEY') {
+ if (!$enableAssistant) {
+ $input[$var['name']] = '';
+ continue;
+ }
+
+ // key already exists
+ if (!empty($var['default'])) {
+ $input[$var['name']] = $var['default'];
+ continue;
+ }
+
+ // if assistant enabled and no key, ask for it
+ if (Console::isInteractive() && $interactive === 'Y') {
+ $input[$var['name']] = Console::confirm('Enter your OpenAI API key for Appwrite Assistant:');
+ if (empty($input[$var['name']])) {
+ Console::warning('No API key provided. Assistant will be disabled.');
+ $enableAssistant = false;
+ $input[$var['name']] = '';
+ }
+ continue;
+ }
+
+ $input[$var['name']] = '';
+ continue;
+ }
+
if (!empty($var['filter']) && ($interactive !== 'Y' || !Console::isInteractive())) {
if ($data && $var['default'] !== null) {
$input[$var['name']] = $var['default'];
@@ -199,7 +232,8 @@ class Install extends Action
->setParam('httpsPort', $httpsPort)
->setParam('version', APP_VERSION_STABLE)
->setParam('organization', $organization)
- ->setParam('image', $image);
+ ->setParam('image', $image)
+ ->setParam('enableAssistant', $enableAssistant);
$templateForEnv->setParam('vars', $input);