| 149 | |
| 150 | // 解析CSV行,处理引号内的逗号 |
| 151 | function parseCSVLine(line: string): string[] { |
| 152 | const result: string[] = []; |
| 153 | let current = ''; |
| 154 | let inQuotes = false; |
| 155 | |
| 156 | for (let i = 0; i < line.length; i++) { |
| 157 | const char = line[i]; |
| 158 | |
| 159 | if (char === '"') { |
| 160 | inQuotes = !inQuotes; |
| 161 | } else if (char === ',' && !inQuotes) { |
| 162 | result.push(current.trim()); |
| 163 | current = ''; |
| 164 | } else { |
| 165 | current += char; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | result.push(current.trim()); |
| 170 | return result; |
| 171 | } |
| 172 | |
| 173 | // 获取所有分类选项 |
| 174 | export function getCategories(models: ProcessedModelData[]) { |