wtt-connect 0.1.8 → 0.1.9
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/package.json +1 -1
- package/src/runner.js +9 -1
package/package.json
CHANGED
package/src/runner.js
CHANGED
|
@@ -305,7 +305,7 @@ export class Runner {
|
|
|
305
305
|
type: 'opendesign',
|
|
306
306
|
metadata: { message_id: message.id || message.message_id || '', generated_by: adapter.name },
|
|
307
307
|
});
|
|
308
|
-
const previewUrl = artifact.preview_url || artifact.url;
|
|
308
|
+
const previewUrl = webPreviewUrl(artifact.preview_url || artifact.url);
|
|
309
309
|
if (previewUrl) {
|
|
310
310
|
const title = artifact.title || 'OpenDesign artifact';
|
|
311
311
|
await this.wtt.publish(topicId, `[opendesign:${title}](${previewUrl})`, 'TASK_ARTIFACT');
|
|
@@ -370,6 +370,14 @@ function inferLocale(text) {
|
|
|
370
370
|
return /[\u4e00-\u9fff]/.test(String(text || '')) ? 'zh' : 'en';
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
function webPreviewUrl(url) {
|
|
374
|
+
const text = String(url || '').trim();
|
|
375
|
+
if (!text) return '';
|
|
376
|
+
if (text.startsWith('/api/wtt/')) return text;
|
|
377
|
+
if (text.startsWith('/artifacts/')) return `/api/wtt${text}`;
|
|
378
|
+
return text;
|
|
379
|
+
}
|
|
380
|
+
|
|
373
381
|
function messageTopicType(m) {
|
|
374
382
|
return String(m.topic_type || metadataValue(m.metadata, 'topic_type') || metadataValue(m.metadata, 'topicType') || '').toLowerCase();
|
|
375
383
|
}
|