@@ -508,7 +508,7 @@
{{ t('integration_openai', 'Usage quotas per time period') }}
- {{ t('integration_openai', 'A per-user quota for each quota type can be set. If the user has not provided their own API key, this quota will be enforced.') }}
+ {{ t('integration_openai', 'A per-user quota for each quota type can be set. If the user has not provided their own API key, and a rule is not specified for this user or any of their groups, this quota will be enforced.') }}
{{ t('integration_openai', '"0" means unlimited usage for a particular quota type.') }}
@@ -546,6 +546,8 @@
+
{{ t('integration_openai', 'Quota Rules') }}
+
@@ -593,6 +595,7 @@ import EarthIcon from 'vue-material-design-icons/Earth.vue'
import HelpCircleOutlineIcon from 'vue-material-design-icons/HelpCircleOutline.vue'
import KeyOutlineIcon from 'vue-material-design-icons/KeyOutline.vue'
import TimerAlertOutlineIcon from 'vue-material-design-icons/TimerAlertOutline.vue'
+import QuotaRules from './Rules/QuotaRules.vue'
import OpenAiIcon from './icons/OpenAiIcon.vue'
@@ -631,6 +634,7 @@ export default {
NcTextField,
NcInputField,
NcNoteCard,
+ QuotaRules,
},
data() {
@@ -980,4 +984,7 @@ export default {
margin: 0 !important;
}
}
+.notecard {
+ max-width: 900px;
+}
diff --git a/src/components/PersonalSettings.vue b/src/components/PersonalSettings.vue
index 6fd4c7e2..95a86f75 100644
--- a/src/components/PersonalSettings.vue
+++ b/src/components/PersonalSettings.vue
@@ -87,6 +87,9 @@
{{ t('integration_openai', 'Usage quota info') }}
+
+ {{ t('integration_openai', 'If you see a shared quota usage of 50% and a usage of 10% that means that you have used 10% of the total shared quota, and the sum of all other users affected by this quota is 40%.') }}
+
@@ -95,6 +98,9 @@
{{ t('integration_openai', 'Quota type') }}
| {{ t('integration_openai', 'Usage') }} |
+
+ {{ t('integration_openai', 'Shared Usage') }}
+ |
@@ -106,6 +112,12 @@
{{ quota.used + ' ' + quota.unit }}
|
+
+ {{ quota.limit > 0 ? Math.round(quota.used_pool / quota.limit * 100) + ' %' : quota.used_pool + ' ' + quota.unit }}
+ |
+
+ {{ t('integration_openai', 'Not Shared') }}
+ |
@@ -175,6 +187,9 @@ export default {
: n('integration_openai', 'The quota is kept over a floating period of the last %n day',
'The quota is kept over a floating period of the last %n days', this.quotaInfo.period.length)
},
+ poolUsed() {
+ return this.quotaInfo !== null && this.quotaInfo.quota_usage.some((quota) => quota.used_pool)
+ },
},
watch: {},
diff --git a/src/components/QuotaPeriodPicker.vue b/src/components/QuotaPeriodPicker.vue
index 12db6fc3..ca3b6053 100644
--- a/src/components/QuotaPeriodPicker.vue
+++ b/src/components/QuotaPeriodPicker.vue
@@ -16,9 +16,10 @@
+ @update:model-value="$event >= 1 && update('length', $event)" />
+ @update:model-value="$event >= 1 && $event <= 28 && update('day', $event)" />