mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Add memory plugin with semantic search and session planning (#145)
* Add memory plugin with semantic search and session planning * Clarify Memory Plugin is optional in docs
This commit is contained in:
1 parent
da283a82cf
commit
3461f86556
132 files changed
+11448
-2834
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { mkdirSync, existsSync } from 'fs'
|
||||
import { homedir, platform } from 'os'
|
||||
import { join } from 'path'
|
||||
|
||||
const xdgDataHome = process.env['XDG_DATA_HOME'] || join(homedir(), platform() === 'win32' ? 'AppData' : '.local', 'share')
|
||||
const cacheDir = join(xdgDataHome, 'opencode', 'memory', 'models')
|
||||
|
||||
if (!existsSync(cacheDir)) {
|
||||
mkdirSync(cacheDir, { recursive: true })
|
||||
}
|
||||
|
||||
async function downloadModel(modelName) {
|
||||
console.log(`Downloading model: ${modelName}...`)
|
||||
const { env, pipeline } = await import('@huggingface/transformers')
|
||||
env.cacheDir = cacheDir
|
||||
await pipeline('feature-extraction', modelName, { dtype: 'fp32' })
|
||||
console.log(`Downloaded: ${modelName}`)
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log(`Cache directory: ${cacheDir}`)
|
||||
|
||||
const models = [
|
||||
'sentence-transformers/all-MiniLM-L6-v2',
|
||||
]
|
||||
|
||||
for (const model of models) {
|
||||
try {
|
||||
await downloadModel(model)
|
||||
} catch (error) {
|
||||
console.error(`Failed to download ${model}:`, error.message)
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Model download complete.')
|
||||
}
|
||||
|
||||
main()
|
||||
Reference in new issue
Block a user