mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-03 00:33:13 +00:00
Merge pull request #2521 from Brisbanehuang/codex/fix-subscription-model-scopes
fix: hide model scopes for non-antigravity plans
This commit is contained in:
5 files changed
+112
No files matched your search
@@ -2862,6 +2862,7 @@ import {
|
||||
resetMessagesDispatchFormState,
|
||||
type MessagesDispatchMappingRow,
|
||||
} from "./groupsMessagesDispatch";
|
||||
import { normalizeSupportedModelScopesForPlatform } from "./groupsSupportedModelScopes";
|
||||
|
||||
const { t } = useI18n();
|
||||
const appStore = useAppStore();
|
||||
@@ -3707,6 +3708,10 @@ const handleCreateGroup = async () => {
|
||||
model_routing: convertRoutingRulesToApiFormat(
|
||||
createModelRoutingRules.value,
|
||||
),
|
||||
supported_model_scopes: normalizeSupportedModelScopesForPlatform(
|
||||
createForm.platform,
|
||||
createForm.supported_model_scopes,
|
||||
),
|
||||
messages_dispatch_model_config:
|
||||
createForm.platform === "openai"
|
||||
? messagesDispatchFormStateToConfig({
|
||||
@@ -3838,6 +3843,10 @@ const handleUpdateGroup = async () => {
|
||||
model_routing: convertRoutingRulesToApiFormat(
|
||||
editModelRoutingRules.value,
|
||||
),
|
||||
supported_model_scopes: normalizeSupportedModelScopesForPlatform(
|
||||
editForm.platform,
|
||||
editForm.supported_model_scopes,
|
||||
),
|
||||
messages_dispatch_model_config:
|
||||
editForm.platform === "openai"
|
||||
? messagesDispatchFormStateToConfig({
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { normalizeSupportedModelScopesForPlatform } from "../groupsSupportedModelScopes";
|
||||
|
||||
describe("normalizeSupportedModelScopesForPlatform", () => {
|
||||
it("preserves model scopes for Antigravity groups", () => {
|
||||
expect(
|
||||
normalizeSupportedModelScopesForPlatform("antigravity", [
|
||||
"claude",
|
||||
"gemini_text",
|
||||
]),
|
||||
).toEqual(["claude", "gemini_text"]);
|
||||
});
|
||||
|
||||
it("returns an empty array for Antigravity groups without scopes", () => {
|
||||
expect(normalizeSupportedModelScopesForPlatform("antigravity", undefined)).toEqual([]);
|
||||
});
|
||||
|
||||
it("drops hidden model scopes for OpenAI groups", () => {
|
||||
expect(
|
||||
normalizeSupportedModelScopesForPlatform("openai", [
|
||||
"claude",
|
||||
"gemini_text",
|
||||
"gemini_image",
|
||||
]),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("drops hidden model scopes for other non-Antigravity groups", () => {
|
||||
expect(normalizeSupportedModelScopesForPlatform("claude", ["claude"])).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,7 @@
|
||||
export const normalizeSupportedModelScopesForPlatform = (
|
||||
platform: string,
|
||||
scopes: string[] | undefined,
|
||||
): string[] => {
|
||||
if (platform !== "antigravity") return [];
|
||||
return scopes ?? [];
|
||||
};
|
||||
Reference in new issue
Block a user