mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-14 11:12:17 +03:00
chore: populate model combo targets and mapping
This commit is contained in:
committed by
diegosouzapw
parent
aae408f585
commit
40df6e0a0a
4
.state/session.md
Normal file
4
.state/session.md
Normal file
@@ -0,0 +1,4 @@
|
||||
- Session initialized at Tue Aug 4 00:05:16 CEST 2026
|
||||
- Session initialized at Tue Aug 4 00:05:30 CEST 2026
|
||||
- Session initialized at Tue Aug 4 00:06:20 CEST 2026
|
||||
- Session initialized at Thu Aug 6 20:06:52 CEST 2026
|
||||
22
insert_mappings.cjs
Normal file
22
insert_mappings.cjs
Normal file
@@ -0,0 +1,22 @@
|
||||
const Database = require('better-sqlite3');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
|
||||
const db = new Database('/Users/work/.omniroute/storage.sqlite');
|
||||
const combos = db.prepare("SELECT id, name FROM combos").all();
|
||||
const now = new Date().toISOString();
|
||||
|
||||
for (const combo of combos) {
|
||||
const mappingId = uuidv4();
|
||||
// Map the combo name directly as the pattern
|
||||
try {
|
||||
db.prepare(`
|
||||
INSERT INTO model_combo_mappings
|
||||
(id, pattern, combo_id, priority, enabled, description, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`).run(mappingId, combo.name, combo.id, 100, 1, `Auto-mapped combo: ${combo.name}`, now, now);
|
||||
console.log(`Mapped pattern '${combo.name}' to combo '${combo.name}'`);
|
||||
} catch(e) {
|
||||
console.log(`Error mapping ${combo.name}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
console.log("Done.");
|
||||
24
insert_mappings.js
Normal file
24
insert_mappings.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const Database = require("better-sqlite3");
|
||||
const { v4: uuidv4 } = require("uuid");
|
||||
|
||||
const db = new Database("/Users/work/.omniroute/storage.sqlite");
|
||||
const combos = db.prepare("SELECT id, name FROM combos").all();
|
||||
const now = new Date().toISOString();
|
||||
|
||||
for (const combo of combos) {
|
||||
const mappingId = uuidv4();
|
||||
// Map the combo name directly as the pattern
|
||||
try {
|
||||
db.prepare(
|
||||
`
|
||||
INSERT INTO model_combo_mappings
|
||||
(id, pattern, combo_id, priority, enabled, description, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`
|
||||
).run(mappingId, combo.name, combo.id, 100, 1, `Auto-mapped combo: ${combo.name}`, now, now);
|
||||
console.log(`Mapped pattern '${combo.name}' to combo '${combo.name}'`);
|
||||
} catch (e) {
|
||||
console.log(`Error mapping ${combo.name}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
console.log("Done.");
|
||||
34030
pnpm-lock.yaml
generated
Normal file
34030
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
49
update_combos.cjs
Normal file
49
update_combos.cjs
Normal file
@@ -0,0 +1,49 @@
|
||||
const Database = require('better-sqlite3');
|
||||
|
||||
const db = new Database('/Users/work/.omniroute/storage.sqlite');
|
||||
const combos = db.prepare("SELECT id, name, data FROM combos").all();
|
||||
const now = new Date().toISOString();
|
||||
|
||||
const modelsMap = {
|
||||
'coding': [
|
||||
{ provider: 'deepseek', model: 'deepseek-coder' },
|
||||
{ provider: 'mistral', model: 'codestral-latest' },
|
||||
{ provider: 'groq', model: 'llama-3.1-70b-versatile' }
|
||||
],
|
||||
'free-agent': [
|
||||
{ provider: 'gemini', model: 'gemini-2.0-flash' },
|
||||
{ provider: 'groq', model: 'llama-3.1-70b-versatile' },
|
||||
{ provider: 'nvidia', model: 'meta/llama-3.1-70b-instruct' }
|
||||
],
|
||||
'smart': [
|
||||
{ provider: 'gemini', model: 'gemini-2.5-pro' },
|
||||
{ provider: 'deepseek', model: 'deepseek-chat' }
|
||||
],
|
||||
'fast-small': [
|
||||
{ provider: 'groq', model: 'llama-3.1-8b-instant' },
|
||||
{ provider: 'gemini', model: 'gemini-2.0-flash-lite' }
|
||||
],
|
||||
'free-reasoning': [
|
||||
{ provider: 'openrouter', model: 'deepseek/deepseek-r1:free' },
|
||||
{ provider: 'nvidia', model: 'deepseek-ai/deepseek-r1' }
|
||||
],
|
||||
'fallback-all': [
|
||||
{ provider: 'gemini', model: 'gemini-2.0-flash' },
|
||||
{ provider: 'groq', model: 'llama-3.1-70b-versatile' }
|
||||
]
|
||||
};
|
||||
|
||||
for (const row of combos) {
|
||||
try {
|
||||
const data = JSON.parse(row.data);
|
||||
if (modelsMap[row.name]) {
|
||||
data.models = modelsMap[row.name];
|
||||
db.prepare(`UPDATE combos SET data = ?, updated_at = ? WHERE id = ?`)
|
||||
.run(JSON.stringify(data), now, row.id);
|
||||
console.log(`Updated combo '${row.name}' with ${data.models.length} models.`);
|
||||
}
|
||||
} catch(e) {
|
||||
console.log(`Error updating ${row.name}: ${e.message}`);
|
||||
}
|
||||
}
|
||||
console.log("Done.");
|
||||
Reference in New Issue
Block a user