groove-dev 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@groove-dev/daemon/src/api.js +10 -0
- package/node_modules/@groove-dev/daemon/src/skills.js +20 -0
- package/node_modules/@groove-dev/gui/dist/assets/index-8Kqi_LVo.js +74 -0
- package/node_modules/@groove-dev/gui/dist/index.html +1 -1
- package/node_modules/@groove-dev/gui/src/views/SkillsMarketplace.jsx +112 -1
- package/package.json +1 -1
- package/packages/daemon/src/api.js +10 -0
- package/packages/daemon/src/skills.js +20 -0
- package/packages/gui/dist/assets/index-8Kqi_LVo.js +74 -0
- package/packages/gui/dist/index.html +1 -1
- package/packages/gui/src/views/SkillsMarketplace.jsx +112 -1
- package/node_modules/@groove-dev/gui/dist/assets/index-CNCSwHwH.js +0 -74
- package/packages/gui/dist/assets/index-CNCSwHwH.js +0 -74
|
@@ -400,6 +400,16 @@ export function createApi(app, daemon) {
|
|
|
400
400
|
}
|
|
401
401
|
});
|
|
402
402
|
|
|
403
|
+
app.post('/api/skills/:id/rate', async (req, res) => {
|
|
404
|
+
try {
|
|
405
|
+
const rating = parseInt(req.body?.rating, 10);
|
|
406
|
+
const result = await daemon.skills.rate(req.params.id, rating);
|
|
407
|
+
res.json(result);
|
|
408
|
+
} catch (err) {
|
|
409
|
+
res.status(400).json({ error: err.message });
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
|
|
403
413
|
app.get('/api/skills/:id/content', (req, res) => {
|
|
404
414
|
const content = daemon.skills.getContent(req.params.id);
|
|
405
415
|
if (!content) return res.status(404).json({ error: 'Skill not installed' });
|
|
@@ -193,6 +193,26 @@ export class SkillStore {
|
|
|
193
193
|
return { id: skillId, installed: false };
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
/**
|
|
197
|
+
* Rate a skill. Proxies to the skills server.
|
|
198
|
+
*/
|
|
199
|
+
async rate(skillId, rating) {
|
|
200
|
+
if (!Number.isInteger(rating) || rating < 1 || rating > 5) {
|
|
201
|
+
throw new Error('Rating must be an integer from 1 to 5');
|
|
202
|
+
}
|
|
203
|
+
const res = await fetch(`${SKILLS_API}/skills/${skillId}/rate`, {
|
|
204
|
+
method: 'POST',
|
|
205
|
+
headers: { 'Content-Type': 'application/json' },
|
|
206
|
+
body: JSON.stringify({ rating }),
|
|
207
|
+
signal: AbortSignal.timeout(10000),
|
|
208
|
+
});
|
|
209
|
+
if (!res.ok) {
|
|
210
|
+
const data = await res.json().catch(() => ({}));
|
|
211
|
+
throw new Error(data.error || 'Rating failed');
|
|
212
|
+
}
|
|
213
|
+
return res.json();
|
|
214
|
+
}
|
|
215
|
+
|
|
196
216
|
/**
|
|
197
217
|
* Get the full content of an installed skill.
|
|
198
218
|
*/
|