| 242 | |
| 243 | // Get the path of the db file for a memory |
| 244 | export function getMemoryDbPath(memoryName: string): string { |
| 245 | // Process.cwd() returns the current working directory of the Node.js process. |
| 246 | // This is the directory from which the script is run. It is always the root of the project. |
| 247 | |
| 248 | // Path is cwd()/.baseai/db/{memoryName}.json |
| 249 | const projectRootPath = process.cwd(); |
| 250 | |
| 251 | // Db file path |
| 252 | const memoryDBPath = path.join( |
| 253 | projectRootPath, |
| 254 | '.baseai', |
| 255 | 'db', |
| 256 | `${memoryName}.json` |
| 257 | ); |
| 258 | |
| 259 | return memoryDBPath; |
| 260 | } |