mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-20 00:18:55 +00:00
Add the group Fast admin switch
This commit is contained in:
@@ -1581,6 +1581,45 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- OpenAI Fast 开关(OpenAI 与 Composite 平台) -->
|
||||
<div
|
||||
v-if="supportsGroupOpenAIFast(createForm.platform)"
|
||||
class="border-t border-gray-200 dark:border-dark-400 pt-4 mt-4"
|
||||
>
|
||||
<h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-3">
|
||||
{{ t("admin.groups.openaiFast.title") }}
|
||||
</h4>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<label class="text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ t("admin.groups.openaiFast.force") }}
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="createForm.force_openai_fast"
|
||||
:aria-label="t('admin.groups.openaiFast.force')"
|
||||
data-testid="create-force-openai-fast"
|
||||
@click="createForm.force_openai_fast = !createForm.force_openai_fast"
|
||||
class="relative inline-flex h-6 w-12 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none"
|
||||
:class="
|
||||
createForm.force_openai_fast
|
||||
? 'bg-primary-500'
|
||||
: 'bg-gray-300 dark:bg-dark-600'
|
||||
"
|
||||
>
|
||||
<span
|
||||
class="pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"
|
||||
:class="
|
||||
createForm.force_openai_fast ? 'translate-x-6' : 'translate-x-1'
|
||||
"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">
|
||||
{{ t("admin.groups.openaiFast.hint") }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Codex Live 开关(OpenAI 与 Composite 平台) -->
|
||||
<div
|
||||
v-if="supportsLivePlatform(createForm.platform)"
|
||||
@@ -3309,6 +3348,45 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- OpenAI Fast 开关(OpenAI 与 Composite 平台) -->
|
||||
<div
|
||||
v-if="supportsGroupOpenAIFast(editForm.platform)"
|
||||
class="border-t border-gray-200 dark:border-dark-400 pt-4 mt-4"
|
||||
>
|
||||
<h4 class="text-sm font-medium text-gray-700 dark:text-gray-300 mb-3">
|
||||
{{ t("admin.groups.openaiFast.title") }}
|
||||
</h4>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<label class="text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ t("admin.groups.openaiFast.force") }}
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="editForm.force_openai_fast"
|
||||
:aria-label="t('admin.groups.openaiFast.force')"
|
||||
data-testid="edit-force-openai-fast"
|
||||
@click="editForm.force_openai_fast = !editForm.force_openai_fast"
|
||||
class="relative inline-flex h-6 w-12 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none"
|
||||
:class="
|
||||
editForm.force_openai_fast
|
||||
? 'bg-primary-500'
|
||||
: 'bg-gray-300 dark:bg-dark-600'
|
||||
"
|
||||
>
|
||||
<span
|
||||
class="pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out"
|
||||
:class="
|
||||
editForm.force_openai_fast ? 'translate-x-6' : 'translate-x-1'
|
||||
"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">
|
||||
{{ t("admin.groups.openaiFast.hint") }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Codex Live 开关(OpenAI 与 Composite 平台) -->
|
||||
<div
|
||||
v-if="supportsLivePlatform(editForm.platform)"
|
||||
@@ -4476,6 +4554,10 @@ import {
|
||||
supportsMessagesDispatchPlatform,
|
||||
type MessagesDispatchMappingRow,
|
||||
} from "./groupsMessagesDispatch";
|
||||
import {
|
||||
normalizeGroupOpenAIFast,
|
||||
supportsGroupOpenAIFast,
|
||||
} from "./groupsOpenAIFast";
|
||||
import {
|
||||
buildModelsListConfig,
|
||||
createModelsListState as createInitialModelsListState,
|
||||
@@ -5047,6 +5129,7 @@ const createForm = reactive({
|
||||
weekly_limit_usd: null as number | null,
|
||||
monthly_limit_usd: null as number | null,
|
||||
long_context_pricing_enabled: true,
|
||||
force_openai_fast: false,
|
||||
model_pricing: [] as PricingFormEntry[],
|
||||
// 图片生成计费配置
|
||||
allow_image_generation: false,
|
||||
@@ -5408,6 +5491,7 @@ const editForm = reactive({
|
||||
weekly_limit_usd: null as number | null,
|
||||
monthly_limit_usd: null as number | null,
|
||||
long_context_pricing_enabled: true,
|
||||
force_openai_fast: false,
|
||||
model_pricing: [] as PricingFormEntry[],
|
||||
// 图片生成计费配置
|
||||
allow_image_generation: false,
|
||||
@@ -5882,6 +5966,7 @@ const closeCreateModal = () => {
|
||||
createForm.video_price_1080p = null;
|
||||
createForm.video_model_prices = createVideoModelPricesForm();
|
||||
createForm.long_context_pricing_enabled = true;
|
||||
createForm.force_openai_fast = false;
|
||||
createForm.model_pricing = [];
|
||||
createForm.web_search_price_per_call = null;
|
||||
createForm.search_price_per_1k = null;
|
||||
@@ -5982,6 +6067,10 @@ const handleCreateGroup = async () => {
|
||||
// 构建请求数据,包含模型路由配置
|
||||
const requestData = {
|
||||
...createGroupForm,
|
||||
force_openai_fast: normalizeGroupOpenAIFast(
|
||||
createForm.platform,
|
||||
createForm.force_openai_fast,
|
||||
),
|
||||
model_pricing: groupPricingToAPI(
|
||||
createForm.model_pricing,
|
||||
createForm.platform,
|
||||
@@ -6110,6 +6199,7 @@ const handleEdit = async (group: AdminGroup) => {
|
||||
editForm.monthly_limit_usd = group.monthly_limit_usd;
|
||||
editForm.long_context_pricing_enabled =
|
||||
group.long_context_pricing_enabled ?? true;
|
||||
editForm.force_openai_fast = group.force_openai_fast ?? false;
|
||||
editForm.model_pricing = groupPricingFromAPI(group.model_pricing);
|
||||
editForm.allow_image_generation = group.allow_image_generation ?? false;
|
||||
editForm.allow_batch_image_generation =
|
||||
@@ -6216,6 +6306,7 @@ const closeEditModal = () => {
|
||||
editForm.video_price_1080p = null;
|
||||
editForm.video_model_prices = createVideoModelPricesForm();
|
||||
editForm.long_context_pricing_enabled = true;
|
||||
editForm.force_openai_fast = false;
|
||||
editForm.model_pricing = [];
|
||||
editForm.web_search_price_per_call = null;
|
||||
editForm.search_price_per_1k = null;
|
||||
@@ -6249,6 +6340,10 @@ const handleUpdateGroup = async () => {
|
||||
// 转换 fallback_group_id: null -> 0 (后端使用 0 表示清除)
|
||||
const payload = {
|
||||
...editForm,
|
||||
force_openai_fast: normalizeGroupOpenAIFast(
|
||||
editForm.platform,
|
||||
editForm.force_openai_fast,
|
||||
),
|
||||
model_pricing: groupPricingToAPI(
|
||||
editForm.model_pricing,
|
||||
editForm.platform,
|
||||
|
||||
Reference in New Issue
Block a user