@galaxy-stack/blackhole-cli 2.0.0-alpha.13 → 2.0.0-alpha.14
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/web/brand/client.template.js +34 -0
- package/web/brand/lib/client.js +34 -0
package/package.json
CHANGED
|
@@ -34,6 +34,39 @@ window.__ModuleLoader__.load({
|
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/* The injected-context row prints its producer as a raw plugin id, so the
|
|
38
|
+
reader sees "@deepseek-ai/dsh-system-prompt". Rename the harness
|
|
39
|
+
producers to readable labels: "Chèn ngữ cảnh · System prompt". */
|
|
40
|
+
const CONTEXT_SOURCE_ID = /^@deepseek-ai\/dsh-([a-z0-9-]+)$/i;
|
|
41
|
+
function friendlyContextSource(raw) {
|
|
42
|
+
var match = CONTEXT_SOURCE_ID.exec(raw);
|
|
43
|
+
if (!match) return undefined;
|
|
44
|
+
var words = match[1].split("-");
|
|
45
|
+
for (var i = 0; i < words.length; i += 1) words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1);
|
|
46
|
+
var label = words.join(" ");
|
|
47
|
+
return label === "System Prompt" ? "System prompt" : label;
|
|
48
|
+
}
|
|
49
|
+
/** Rewrite every visible producer label; React re-renders are re-applied. */
|
|
50
|
+
function relabelContextSources() {
|
|
51
|
+
if (typeof document === "undefined") return;
|
|
52
|
+
var nodes = document.querySelectorAll("[data-context-source]");
|
|
53
|
+
for (var i = 0; i < nodes.length; i += 1) {
|
|
54
|
+
var node = nodes[i];
|
|
55
|
+
var label = friendlyContextSource((node.textContent || "").trim());
|
|
56
|
+
if (label !== undefined && node.textContent !== label) node.textContent = label;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function watchContextSources() {
|
|
60
|
+
if (typeof document === "undefined" || typeof MutationObserver === "undefined") return;
|
|
61
|
+
relabelContextSources();
|
|
62
|
+
var scheduled = false;
|
|
63
|
+
new MutationObserver(function () {
|
|
64
|
+
if (scheduled) return;
|
|
65
|
+
scheduled = true;
|
|
66
|
+
Promise.resolve().then(function () { scheduled = false; relabelContextSources(); });
|
|
67
|
+
}).observe(document.body, { childList: true, subtree: true, characterData: true });
|
|
68
|
+
}
|
|
69
|
+
|
|
37
70
|
const GALAXY_KEY_REF = "GBH_GALAXY_API_KEY";
|
|
38
71
|
/** Show a Galaxy-specific dialog when the Galaxy key is not configured. */
|
|
39
72
|
function ensureGalaxyKey(ctx) {
|
|
@@ -209,6 +242,7 @@ window.__ModuleLoader__.load({
|
|
|
209
242
|
});
|
|
210
243
|
});
|
|
211
244
|
ensureGalaxyKey(ctx);
|
|
245
|
+
watchContextSources();
|
|
212
246
|
}
|
|
213
247
|
exports.apply = apply;
|
|
214
248
|
exports.inject = inject;
|
package/web/brand/lib/client.js
CHANGED
|
@@ -1022,6 +1022,39 @@ window.__ModuleLoader__.load({
|
|
|
1022
1022
|
});
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
|
+
/* The injected-context row prints its producer as a raw plugin id, so the
|
|
1026
|
+
reader sees "@deepseek-ai/dsh-system-prompt". Rename the harness
|
|
1027
|
+
producers to readable labels: "Chèn ngữ cảnh · System prompt". */
|
|
1028
|
+
const CONTEXT_SOURCE_ID = /^@deepseek-ai\/dsh-([a-z0-9-]+)$/i;
|
|
1029
|
+
function friendlyContextSource(raw) {
|
|
1030
|
+
var match = CONTEXT_SOURCE_ID.exec(raw);
|
|
1031
|
+
if (!match) return undefined;
|
|
1032
|
+
var words = match[1].split("-");
|
|
1033
|
+
for (var i = 0; i < words.length; i += 1) words[i] = words[i].charAt(0).toUpperCase() + words[i].slice(1);
|
|
1034
|
+
var label = words.join(" ");
|
|
1035
|
+
return label === "System Prompt" ? "System prompt" : label;
|
|
1036
|
+
}
|
|
1037
|
+
/** Rewrite every visible producer label; React re-renders are re-applied. */
|
|
1038
|
+
function relabelContextSources() {
|
|
1039
|
+
if (typeof document === "undefined") return;
|
|
1040
|
+
var nodes = document.querySelectorAll("[data-context-source]");
|
|
1041
|
+
for (var i = 0; i < nodes.length; i += 1) {
|
|
1042
|
+
var node = nodes[i];
|
|
1043
|
+
var label = friendlyContextSource((node.textContent || "").trim());
|
|
1044
|
+
if (label !== undefined && node.textContent !== label) node.textContent = label;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
function watchContextSources() {
|
|
1048
|
+
if (typeof document === "undefined" || typeof MutationObserver === "undefined") return;
|
|
1049
|
+
relabelContextSources();
|
|
1050
|
+
var scheduled = false;
|
|
1051
|
+
new MutationObserver(function () {
|
|
1052
|
+
if (scheduled) return;
|
|
1053
|
+
scheduled = true;
|
|
1054
|
+
Promise.resolve().then(function () { scheduled = false; relabelContextSources(); });
|
|
1055
|
+
}).observe(document.body, { childList: true, subtree: true, characterData: true });
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1025
1058
|
const GALAXY_KEY_REF = "GBH_GALAXY_API_KEY";
|
|
1026
1059
|
/** Show a Galaxy-specific dialog when the Galaxy key is not configured. */
|
|
1027
1060
|
function ensureGalaxyKey(ctx) {
|
|
@@ -1197,6 +1230,7 @@ window.__ModuleLoader__.load({
|
|
|
1197
1230
|
});
|
|
1198
1231
|
});
|
|
1199
1232
|
ensureGalaxyKey(ctx);
|
|
1233
|
+
watchContextSources();
|
|
1200
1234
|
}
|
|
1201
1235
|
exports.apply = apply;
|
|
1202
1236
|
exports.inject = inject;
|