Files
dbx/apps/desktop/src/lib/aiModelPresentation.ts
T
二丫讲梵 c2aeaaa8f7 feat(ai): 添加 Codex CLI 命令解析和环境变量处理功能
- 实现了对 Codex CLI 命令的解析,支持路径解析和环境变量设置
- 增加了对命令环境的处理,确保正确的执行路径
- 添加了相关的单元测试,确保功能的正确性
2026-06-25 16:47:43 +08:00

26 lines
740 B
TypeScript

export interface AiModelPresentation {
primary: string;
secondary?: string;
}
function compactModelName(value: string): string {
return value
.trim()
.toLowerCase()
.replace(/[\s_-]+/g, "");
}
export function shouldShowAiModelSecondaryLabel(label: string, modelId: string): boolean {
const normalizedLabel = compactModelName(label);
const normalizedId = compactModelName(modelId);
if (!normalizedLabel || !normalizedId || normalizedLabel === normalizedId) return false;
return true;
}
export function formatAiModelOption(label: string, modelId: string): AiModelPresentation {
return {
primary: label || modelId,
secondary: shouldShowAiModelSecondaryLabel(label, modelId) ? modelId : undefined,
};
}