feat(ai): 添加 Codex CLI 命令解析和环境变量处理功能

- 实现了对 Codex CLI 命令的解析,支持路径解析和环境变量设置
- 增加了对命令环境的处理,确保正确的执行路径
- 添加了相关的单元测试,确保功能的正确性
This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-06-25 16:47:43 +08:00
1 parent d96448b5a5
commit c2aeaaa8f7
6 files changed
+360 -12

No files matched your search

@@ -0,0 +1,33 @@
import { describe, expect, it } from "vitest";
import { formatAiModelOption, shouldShowAiModelSecondaryLabel } from "@/lib/aiModelPresentation";
describe("shouldShowAiModelSecondaryLabel", () => {
it("hides secondary text when display name only changes case", () => {
expect(shouldShowAiModelSecondaryLabel("GPT-5.5", "gpt-5.5")).toBe(false);
});
it("hides secondary text when display name only changes separators", () => {
expect(shouldShowAiModelSecondaryLabel("GPT-5.4-Mini", "gpt-5.4-mini")).toBe(false);
});
it("hides secondary text for exact matches", () => {
expect(shouldShowAiModelSecondaryLabel("gpt-5.3-codex", "gpt-5.3-codex")).toBe(false);
});
it("keeps secondary text when provider display name is meaningfully different", () => {
expect(shouldShowAiModelSecondaryLabel("Claude Sonnet 4", "claude-sonnet-4-20250514")).toBe(true);
});
});
describe("formatAiModelOption", () => {
it("returns a single-line Codex-style model option", () => {
expect(formatAiModelOption("GPT-5.5", "gpt-5.5")).toEqual({ primary: "GPT-5.5", secondary: undefined });
});
it("returns model id as secondary text only when useful", () => {
expect(formatAiModelOption("Claude Sonnet 4", "claude-sonnet-4-20250514")).toEqual({
primary: "Claude Sonnet 4",
secondary: "claude-sonnet-4-20250514",
});
});
});