diff --git a/manual/config/roles_permissions.md b/manual/config/roles_permissions.md index 15c7057e..df282120 100644 --- a/manual/config/roles_permissions.md +++ b/manual/config/roles_permissions.md @@ -54,6 +54,11 @@ Seafile comes with two build-in roles `default` and `guest`, a default user is a 'can_publish_wiki': True, 'upload_rate_limit': 0, # unit: kb/s 'download_rate_limit': 0, + 'monthly_rate_limit': '', + 'monthly_rate_limit_per_user': '', + 'can_choose_office_suite': True, + 'monthly_ai_credit_per_user': -1, + 'can_use_sso_in_multi_tenancy': True, }, ``` @@ -82,6 +87,10 @@ While a guest user can only read files/folders in the system, here are the permi 'can_publish_wiki': False, 'upload_rate_limit': 0, 'download_rate_limit': 0, + 'monthly_rate_limit': '', + 'monthly_rate_limit_per_user': '', + 'can_choose_office_suite': False, + 'can_use_sso_in_multi_tenancy': False, }, ``` @@ -113,6 +122,11 @@ ENABLED_ROLE_PERMISSIONS = { 'can_publish_wiki': True, 'upload_rate_limit': 2000, # unit: kb/s 'download_rate_limit': 4000, + 'monthly_rate_limit': '', + 'monthly_rate_limit_per_user': '', + 'can_choose_office_suite': True, + 'monthly_ai_credit_per_user': -1, + 'can_use_sso_in_multi_tenancy': True, }, 'guest': { 'can_add_repo': False, @@ -136,6 +150,10 @@ ENABLED_ROLE_PERMISSIONS = { 'can_publish_wiki': False, 'upload_rate_limit': 100, 'download_rate_limit': 200, + 'monthly_rate_limit': '', + 'monthly_rate_limit_per_user': '', + 'can_choose_office_suite': False, + 'can_use_sso_in_multi_tenancy': False, } } ``` @@ -196,6 +214,11 @@ ENABLED_ROLE_PERMISSIONS = { 'can_publish_wiki': True, 'upload_rate_limit': 2000, # unit: kb/s 'download_rate_limit': 4000, + 'monthly_rate_limit': '', + 'monthly_rate_limit_per_user': '', + 'can_choose_office_suite': True, + 'monthly_ai_credit_per_user': -1, + 'can_use_sso_in_multi_tenancy': True, }, 'guest': { 'can_add_repo': False, @@ -219,6 +242,10 @@ ENABLED_ROLE_PERMISSIONS = { 'can_publish_wiki': False, 'upload_rate_limit': 100, 'download_rate_limit': 200, + 'monthly_rate_limit': '', + 'monthly_rate_limit_per_user': '', + 'can_choose_office_suite': False, + 'can_use_sso_in_multi_tenancy': False, }, 'employee': { 'can_add_repo': True, @@ -242,6 +269,11 @@ ENABLED_ROLE_PERMISSIONS = { 'can_publish_wiki': True, 'upload_rate_limit': 500, 'download_rate_limit': 800, + 'monthly_rate_limit': '', + 'monthly_rate_limit_per_user': '', + 'can_choose_office_suite': True, + 'monthly_ai_credit_per_user': -1, + 'can_use_sso_in_multi_tenancy': True, }, } ``` diff --git a/manual/extension/seafile-ai.md b/manual/extension/seafile-ai.md index cb66a5a3..7f2736b8 100644 --- a/manual/extension/seafile-ai.md +++ b/manual/extension/seafile-ai.md @@ -213,3 +213,25 @@ By default, the access key used by the face embedding is the same as that used b docker compose down docker compose up -d ``` + +## Advanced operations + +### Enable AI usage statistics + +Seafile supports counting users' AI usage (how many tokens are used) and setting monthly AI quotas for users. + +1. Open `$SEAFILE_VOLUME/seafile/conf/seahub_settings.py` and add AI prices (i.e., how much per token) informations: + + ```py + AI_PRICES = { + "gpt-4o-mini": { # replace gpt-4o-mini to your model name + "input_tokens_1k": 0.0011, # input price per token + "output_tokens_1k": 0.0044 # output price per token + } + } + ``` + +2. Refer management of [roles and permission](../config/roles_permissions.md) to specify `monthly_ai_credit_per_user` (`-1` is unlimited), and the unit should be the same as in `AI_PRICES`. + + !!! note "`monthly_ai_credit_per_user` for organization user" + For organizational team users, `monthly_ai_credit_per_user` will apply to the entire team. For example, when `monthly_ai_credit_per_user` is set to `2` (unit of doller for example) and there are 10 members in the team, all members in the team will share the quota of $2\times10=20\$$.