working on the guest user

main
Steffen Pohle 2 weeks ago
parent 7dd4ec8876
commit 7559165749

@ -5,6 +5,40 @@ a simple webpage which will connect to a remote ollama instance and allowes you
## configuration
all configuration is done in the file default.php
All application configuration is now stored in `default.php`.
If you previously used `config.php`, its settings have already been merged into `default.php`.
### key settings
- `USER_CONFIG_DIR`: directory where user data and chat history are saved.
- `OLLAMA_URL`: URL of your remote Ollama instance.
- `GUEST_USER_ENABLED`: enable guest access when set to `true`.
- `GUEST_USERNAME`: guest account username (default is `guest`).
- `DEFAULT_MODEL`: default Ollama model used for new chats.
- `MAIL_FROM` / `MAIL_FROM_NAME`: email sender details for password reset messages.
- `APP_BASE_URL`: the public app URL used to generate links.
- `APP_SECRET`: secret key used for authentication token signing and security.
> Note: change `APP_SECRET` from the default before deploying to production. Use a long, random value and keep it private.
### example settings
```php
<?php
define('USER_CONFIG_DIR', '/var/lib/KaI/users');
// URL of the Ollama API server, e.g. http://127.0.0.1:11434
define('OLLAMA_URL', 'http://127.0.0.1:11434');
define('GUEST_USER_ENABLED', true);
define('GUEST_USERNAME', 'guest');
define('DEFAULT_MODEL', 'llama3.2:latest');
define('MAIL_FROM', getenv('MAIL_FROM') ?: 'noreply@kai.local');
define('MAIL_FROM_NAME', getenv('MAIL_FROM_NAME') ?: 'KaI');
define('APP_BASE_URL', getenv('APP_BASE_URL') ?: 'http://127.0.0.1/KaI-OllamaChat');
define('APP_SECRET', getenv('APP_SECRET') ?: 'change-this-secret');
```

@ -1,8 +0,0 @@
<?php
define('USER_CONFIG_DIR', '/var/lib/KaI/users');
define('OLLAMA_URL', 'http://127.0.0.1:11434');
define('GUEST_USER_ENABLED', true);
define('GUEST_USERNAME', 'guest');
define('DEFAULT_MODEL', 'llama3.2:latest');

@ -1,6 +1,10 @@
<?php
require_once __DIR__ . '/config.php';
define('USER_CONFIG_DIR', '/var/lib/KaI/users');
define('OLLAMA_URL', 'http://127.0.0.1:11434');
define('GUEST_USER_ENABLED', true);
define('GUEST_USERNAME', 'guest');
define('DEFAULT_MODEL', 'llama3.2:latest');
define('MAIL_FROM', getenv('MAIL_FROM') ?: 'noreply@kai.local');
define('MAIL_FROM_NAME', getenv('MAIL_FROM_NAME') ?: 'KaI');

@ -44,7 +44,7 @@ $isGuestSession = isGuestSession();
<?php if (($authUser['role'] ?? 'user') === 'admin'): ?>
<a href="useradmin.php" style="color:#89b4fa; text-decoration:none;">User Admin</a>
<?php endif; ?>
<?php if (isGuestModeEnabled()): ?>
<?php if (isGuestModeEnabled() && isGuestSession()): ?>
<a href="login.php" style="color:#89b4fa; text-decoration:none;">Login</a>
<?php endif; ?>
<a href="logout.php" style="color:#f38ba8; text-decoration:none;">Logout</a>

Loading…
Cancel
Save