()
| 14 | } |
| 15 | |
| 16 | function readStore(): ModelDefinition[] { |
| 17 | const storePath = getStorePath() |
| 18 | if (!fs.existsSync(storePath)) return [] |
| 19 | |
| 20 | try { |
| 21 | const content = fs.readFileSync(storePath, 'utf-8') |
| 22 | return JSON.parse(content) as ModelDefinition[] |
| 23 | } catch (error) { |
| 24 | aiLogger.error('CustomModelStore', 'Failed to read store', error) |
| 25 | return [] |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | function writeStore(models: ModelDefinition[]): void { |
| 30 | const storePath = getStorePath() |
no test coverage detected