refactor(mobile): remove unused provider option summary (#9971)
This commit is contained in:
1 parent
1568b3fd08
commit
c1e279eca5
2 files changed
+2
-34
No files matched your search
@@ -2,11 +2,7 @@ import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import type { ModelCapabilities } from "@t3tools/contracts";
|
||||
|
||||
import {
|
||||
applyProviderOptionSelection,
|
||||
providerOptionValueLabels,
|
||||
resolveProviderOptionDescriptors,
|
||||
} from "./providerOptions";
|
||||
import { applyProviderOptionSelection, resolveProviderOptionDescriptors } from "./providerOptions";
|
||||
|
||||
const CODEX_CAPABILITIES: ModelCapabilities = {
|
||||
optionDescriptors: [
|
||||
@@ -34,15 +30,6 @@ const CODEX_CAPABILITIES: ModelCapabilities = {
|
||||
};
|
||||
|
||||
describe("mobile provider options", () => {
|
||||
it("summarizes the option values currently in effect", () => {
|
||||
const descriptors = resolveProviderOptionDescriptors({
|
||||
capabilities: CODEX_CAPABILITIES,
|
||||
selections: undefined,
|
||||
});
|
||||
|
||||
expect(providerOptionValueLabels(descriptors)).toEqual(["Medium", "Standard"]);
|
||||
});
|
||||
|
||||
it("updates generic select options without knowing provider-specific ids", () => {
|
||||
const descriptors = resolveProviderOptionDescriptors({
|
||||
capabilities: CODEX_CAPABILITIES,
|
||||
@@ -62,7 +49,7 @@ describe("mobile provider options", () => {
|
||||
expect(applyProviderOptionSelection(descriptors, { id: "unknown", value: "high" })).toBeNull();
|
||||
});
|
||||
|
||||
it("treats an unspecified boolean capability as off", () => {
|
||||
it("updates generic boolean options", () => {
|
||||
const descriptors = resolveProviderOptionDescriptors({
|
||||
capabilities: {
|
||||
optionDescriptors: [{ id: "fastMode", label: "Fast Mode", type: "boolean" }],
|
||||
@@ -70,7 +57,6 @@ describe("mobile provider options", () => {
|
||||
selections: undefined,
|
||||
});
|
||||
|
||||
expect(providerOptionValueLabels(descriptors)).toEqual([]);
|
||||
expect(applyProviderOptionSelection(descriptors, { id: "fastMode", value: true })).toEqual([
|
||||
{ id: "fastMode", value: true },
|
||||
]);
|
||||
|
||||
@@ -5,7 +5,6 @@ import type {
|
||||
} from "@t3tools/contracts";
|
||||
import {
|
||||
buildProviderOptionSelectionsFromDescriptors,
|
||||
getProviderOptionCurrentLabel,
|
||||
getProviderOptionDescriptors,
|
||||
} from "@t3tools/shared/model";
|
||||
|
||||
@@ -22,23 +21,6 @@ export function resolveProviderOptionDescriptors(input: {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Labels for the option values currently in effect (select values plus
|
||||
* enabled booleans), used to summarize the thread configuration in the
|
||||
* composer trigger pill.
|
||||
*/
|
||||
export function providerOptionValueLabels(
|
||||
descriptors: ReadonlyArray<ProviderOptionDescriptor>,
|
||||
): ReadonlyArray<string> {
|
||||
return descriptors.flatMap((descriptor) => {
|
||||
if (descriptor.type === "boolean") {
|
||||
return descriptor.currentValue ? [descriptor.label] : [];
|
||||
}
|
||||
const label = getProviderOptionCurrentLabel(descriptor);
|
||||
return label ? [label] : [];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies one option change (by descriptor id) and returns the full selection
|
||||
* list to store on the model selection, or null when the change doesn't match
|
||||
|
||||
Reference in new issue
Block a user