@blueharford/scrypted-spatial-awareness 0.6.10 → 0.6.12
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/dist/main.nodejs.js +1 -1
- package/dist/main.nodejs.js.map +1 -1
- package/dist/plugin.zip +0 -0
- package/out/main.nodejs.js +16 -46
- package/out/main.nodejs.js.map +1 -1
- package/out/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/alerts/alert-manager.ts +2 -1
- package/src/core/spatial-reasoning.ts +14 -42
package/out/plugin.zip
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -70,10 +70,11 @@ export class AlertManager {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// Create alert
|
|
73
|
+
// Note: details.objectLabel may contain LLM-generated description - preserve it if provided
|
|
73
74
|
const fullDetails: AlertDetails = {
|
|
74
75
|
...details,
|
|
75
76
|
objectClass: tracked.className,
|
|
76
|
-
objectLabel: tracked.label,
|
|
77
|
+
objectLabel: details.objectLabel || tracked.label,
|
|
77
78
|
};
|
|
78
79
|
|
|
79
80
|
const alert = createAlert(
|
|
@@ -154,51 +154,23 @@ export type LlmProvider = 'openai' | 'anthropic' | 'scrypted' | 'unknown';
|
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* Build image content block for ChatCompletion API
|
|
157
|
-
*
|
|
157
|
+
*
|
|
158
|
+
* IMPORTANT: @scrypted/llm uses OpenAI-compatible format for ALL providers.
|
|
159
|
+
* The plugin internally converts this format to the appropriate provider format.
|
|
160
|
+
* So we ALWAYS use the OpenAI image_url format with data URI.
|
|
161
|
+
*
|
|
158
162
|
* @param imageData - Image data with base64 and media type
|
|
159
|
-
* @param provider - The LLM provider type
|
|
163
|
+
* @param provider - The LLM provider type (currently unused, kept for logging)
|
|
160
164
|
*/
|
|
161
165
|
export function buildImageContent(imageData: ImageData, provider: LlmProvider = 'unknown'): any {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
};
|
|
171
|
-
} else if (provider === 'anthropic') {
|
|
172
|
-
// Anthropic official format: uses 'data' key
|
|
173
|
-
return {
|
|
174
|
-
type: 'image',
|
|
175
|
-
source: {
|
|
176
|
-
type: 'base64',
|
|
177
|
-
media_type: imageData.mediaType,
|
|
178
|
-
data: imageData.base64,
|
|
179
|
-
},
|
|
180
|
-
};
|
|
181
|
-
} else if (provider === 'scrypted') {
|
|
182
|
-
// @scrypted/llm format: uses 'base64' key (per error path .image.source.base64)
|
|
183
|
-
return {
|
|
184
|
-
type: 'image',
|
|
185
|
-
source: {
|
|
186
|
-
type: 'base64',
|
|
187
|
-
media_type: imageData.mediaType,
|
|
188
|
-
base64: imageData.base64,
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
} else {
|
|
192
|
-
// Unknown provider: try @scrypted/llm format first
|
|
193
|
-
return {
|
|
194
|
-
type: 'image',
|
|
195
|
-
source: {
|
|
196
|
-
type: 'base64',
|
|
197
|
-
media_type: imageData.mediaType,
|
|
198
|
-
base64: imageData.base64,
|
|
199
|
-
},
|
|
200
|
-
};
|
|
201
|
-
}
|
|
166
|
+
// @scrypted/llm uses OpenAI-compatible format for ALL providers
|
|
167
|
+
// The plugin handles internal conversion to Anthropic/other formats
|
|
168
|
+
return {
|
|
169
|
+
type: 'image_url',
|
|
170
|
+
image_url: {
|
|
171
|
+
url: `data:${imageData.mediaType};base64,${imageData.base64}`,
|
|
172
|
+
},
|
|
173
|
+
};
|
|
202
174
|
}
|
|
203
175
|
|
|
204
176
|
/** Check if an error indicates vision/multimodal content format issue (should try alternate format) */
|