smart-home-engine 0.23.0 → 0.23.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-
|
|
1
|
+
import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-CI4cnkU8.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
package/dist/web/index.html
CHANGED
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
}
|
|
156
156
|
})();
|
|
157
157
|
</script>
|
|
158
|
-
<script type="module" crossorigin src="/assets/index-
|
|
158
|
+
<script type="module" crossorigin src="/assets/index-CI4cnkU8.js"></script>
|
|
159
159
|
<link rel="modulepreload" crossorigin href="/assets/monaco-langs-BW2J83t5.js">
|
|
160
160
|
<link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
|
|
161
161
|
<link rel="stylesheet" crossorigin href="/assets/index-BPk8Jr3B.css">
|
package/package.json
CHANGED
package/src/web/ai-api.js
CHANGED
|
@@ -441,14 +441,15 @@ router.post('/prompt', (req, res) => {
|
|
|
441
441
|
// POST /she/ai/chat — non-streaming
|
|
442
442
|
router.post('/chat', async (req, res) => {
|
|
443
443
|
const ai = readAiConfig(req.app.locals.configPath);
|
|
444
|
-
|
|
444
|
+
const { messages = [], currentScript, currentView, currentDoc, context = {}, modelOverride, extraFiles } = req.body || {};
|
|
445
|
+
const effectiveModel = (modelOverride && typeof modelOverride === 'string') ? modelOverride : ai?.model;
|
|
446
|
+
if (!ai?.provider || !effectiveModel) {
|
|
445
447
|
return res.status(400).json({ error: 'AI provider not configured. Set ai.provider and ai.model in Config.' });
|
|
446
448
|
}
|
|
447
449
|
|
|
448
|
-
const { messages = [], currentScript, currentView, currentDoc, context = {}, modelOverride, extraFiles } = req.body || {};
|
|
449
450
|
if (!Array.isArray(messages)) return res.status(400).json({ error: 'messages must be an array' });
|
|
450
451
|
|
|
451
|
-
const aiWithModel =
|
|
452
|
+
const aiWithModel = { ...ai, model: effectiveModel };
|
|
452
453
|
const systemPrompt = buildSystemPrompt(context, currentScript ?? null, currentView ?? null, currentDoc ?? null, _store, extraFiles || []);
|
|
453
454
|
const fullMessages = [{ role: 'system', content: systemPrompt }, ...messages];
|
|
454
455
|
|
|
@@ -471,14 +472,15 @@ router.post('/chat', async (req, res) => {
|
|
|
471
472
|
// POST /she/ai/chat/stream — SSE streaming
|
|
472
473
|
router.post('/chat/stream', async (req, res) => {
|
|
473
474
|
const ai = readAiConfig(req.app.locals.configPath);
|
|
474
|
-
|
|
475
|
+
const { messages = [], currentScript, currentView, currentDoc, context = {}, modelOverride, extraFiles } = req.body || {};
|
|
476
|
+
const effectiveModel = (modelOverride && typeof modelOverride === 'string') ? modelOverride : ai?.model;
|
|
477
|
+
if (!ai?.provider || !effectiveModel) {
|
|
475
478
|
return res.status(400).json({ error: 'AI provider not configured. Set ai.provider and ai.model in Config.' });
|
|
476
479
|
}
|
|
477
480
|
|
|
478
|
-
const { messages = [], currentScript, currentView, currentDoc, context = {}, modelOverride, extraFiles } = req.body || {};
|
|
479
481
|
if (!Array.isArray(messages)) return res.status(400).json({ error: 'messages must be an array' });
|
|
480
482
|
|
|
481
|
-
const aiWithModel =
|
|
483
|
+
const aiWithModel = { ...ai, model: effectiveModel };
|
|
482
484
|
|
|
483
485
|
// Build system prompt BEFORE flushing headers so errors can still return a proper HTTP status
|
|
484
486
|
let systemPrompt;
|