mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 03:52:26 +08:00
Add the free Fast group switch
This commit is contained in:
@@ -1618,6 +1618,35 @@
|
||||
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">
|
||||
{{ t("admin.groups.openaiFast.hint") }}
|
||||
</p>
|
||||
<div class="flex items-center justify-between gap-4 mt-4">
|
||||
<label class="text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ t("admin.groups.openaiFast.free") }}
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="createForm.free_openai_fast"
|
||||
:aria-label="t('admin.groups.openaiFast.free')"
|
||||
data-testid="create-free-openai-fast"
|
||||
@click="createForm.free_openai_fast = !createForm.free_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.free_openai_fast
|
||||
? 'bg-emerald-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.free_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.freeHint") }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Codex Live 开关(OpenAI 与 Composite 平台) -->
|
||||
@@ -3385,6 +3414,35 @@
|
||||
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1">
|
||||
{{ t("admin.groups.openaiFast.hint") }}
|
||||
</p>
|
||||
<div class="flex items-center justify-between gap-4 mt-4">
|
||||
<label class="text-sm text-gray-600 dark:text-gray-400">
|
||||
{{ t("admin.groups.openaiFast.free") }}
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="editForm.free_openai_fast"
|
||||
:aria-label="t('admin.groups.openaiFast.free')"
|
||||
data-testid="edit-free-openai-fast"
|
||||
@click="editForm.free_openai_fast = !editForm.free_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.free_openai_fast
|
||||
? 'bg-emerald-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.free_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.freeHint") }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Codex Live 开关(OpenAI 与 Composite 平台) -->
|
||||
@@ -5130,6 +5188,7 @@ const createForm = reactive({
|
||||
monthly_limit_usd: null as number | null,
|
||||
long_context_pricing_enabled: true,
|
||||
force_openai_fast: false,
|
||||
free_openai_fast: false,
|
||||
model_pricing: [] as PricingFormEntry[],
|
||||
// 图片生成计费配置
|
||||
allow_image_generation: false,
|
||||
@@ -5492,6 +5551,7 @@ const editForm = reactive({
|
||||
monthly_limit_usd: null as number | null,
|
||||
long_context_pricing_enabled: true,
|
||||
force_openai_fast: false,
|
||||
free_openai_fast: false,
|
||||
model_pricing: [] as PricingFormEntry[],
|
||||
// 图片生成计费配置
|
||||
allow_image_generation: false,
|
||||
@@ -5967,6 +6027,7 @@ const closeCreateModal = () => {
|
||||
createForm.video_model_prices = createVideoModelPricesForm();
|
||||
createForm.long_context_pricing_enabled = true;
|
||||
createForm.force_openai_fast = false;
|
||||
createForm.free_openai_fast = false;
|
||||
createForm.model_pricing = [];
|
||||
createForm.web_search_price_per_call = null;
|
||||
createForm.search_price_per_1k = null;
|
||||
@@ -6071,6 +6132,10 @@ const handleCreateGroup = async () => {
|
||||
createForm.platform,
|
||||
createForm.force_openai_fast,
|
||||
),
|
||||
free_openai_fast: normalizeGroupOpenAIFast(
|
||||
createForm.platform,
|
||||
createForm.free_openai_fast,
|
||||
),
|
||||
model_pricing: groupPricingToAPI(
|
||||
createForm.model_pricing,
|
||||
createForm.platform,
|
||||
@@ -6200,6 +6265,7 @@ const handleEdit = async (group: AdminGroup) => {
|
||||
editForm.long_context_pricing_enabled =
|
||||
group.long_context_pricing_enabled ?? true;
|
||||
editForm.force_openai_fast = group.force_openai_fast ?? false;
|
||||
editForm.free_openai_fast = group.free_openai_fast ?? false;
|
||||
editForm.model_pricing = groupPricingFromAPI(group.model_pricing);
|
||||
editForm.allow_image_generation = group.allow_image_generation ?? false;
|
||||
editForm.allow_batch_image_generation =
|
||||
@@ -6307,6 +6373,7 @@ const closeEditModal = () => {
|
||||
editForm.video_model_prices = createVideoModelPricesForm();
|
||||
editForm.long_context_pricing_enabled = true;
|
||||
editForm.force_openai_fast = false;
|
||||
editForm.free_openai_fast = false;
|
||||
editForm.model_pricing = [];
|
||||
editForm.web_search_price_per_call = null;
|
||||
editForm.search_price_per_1k = null;
|
||||
@@ -6344,6 +6411,10 @@ const handleUpdateGroup = async () => {
|
||||
editForm.platform,
|
||||
editForm.force_openai_fast,
|
||||
),
|
||||
free_openai_fast: normalizeGroupOpenAIFast(
|
||||
editForm.platform,
|
||||
editForm.free_openai_fast,
|
||||
),
|
||||
model_pricing: groupPricingToAPI(
|
||||
editForm.model_pricing,
|
||||
editForm.platform,
|
||||
|
||||
@@ -26,11 +26,15 @@ describe("groupsOpenAIFast", () => {
|
||||
title: expect.any(String),
|
||||
force: expect.any(String),
|
||||
hint: expect.stringContaining("service_tier=priority"),
|
||||
free: expect.any(String),
|
||||
freeHint: expect.stringContaining("Standard"),
|
||||
});
|
||||
expect(en.groups.openaiFast).toMatchObject({
|
||||
title: expect.any(String),
|
||||
force: expect.any(String),
|
||||
hint: expect.stringContaining("service_tier=priority"),
|
||||
free: expect.any(String),
|
||||
freeHint: expect.stringContaining("Standard"),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user