mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-11-30 19:26:59 +08:00
* perf(ci): speed up Rust and Vitest pipelines without reducing coverage * fix(test): run clipboard test in jsdom for Node 20 compatibility
29 lines
832 B
TypeScript
29 lines
832 B
TypeScript
import { fireEvent, screen } from "@testing-library/react";
|
|
import { parse as parseYaml } from "yaml";
|
|
|
|
// omp 的编辑框按 models.yml 显示 `providers.<标识>` 这一个节点
|
|
export function ompNode(editor: HTMLTextAreaElement) {
|
|
const { providers } = parseYaml(editor.value) as {
|
|
providers: Record<string, Record<string, any>>;
|
|
};
|
|
return Object.values(providers)[0];
|
|
}
|
|
|
|
export function completeModel(id: string, name = id.trim() || "Model") {
|
|
return {
|
|
id,
|
|
name,
|
|
reasoning: false,
|
|
input: ["text"],
|
|
contextWindow: 128_000,
|
|
maxTokens: 16_384,
|
|
};
|
|
}
|
|
|
|
// 请求头、模型自动发现和接口兼容性收在默认折叠的「高级选项」里
|
|
export function openAdvancedOptions() {
|
|
fireEvent.click(
|
|
screen.getByRole("button", { name: "providerForm.advancedOptionsToggle" }),
|
|
);
|
|
}
|