Spaces:
Running
Running
cccmmd commited on
Commit ·
a30cc58
1
Parent(s): 19ef509
fix: Integrated Lab panels not rendering, Stop button disabled, model select ID mismatch
Browse files
client/src/pages/integrated/index.ts
CHANGED
|
@@ -62,7 +62,7 @@ document.documentElement.lang = 'zh-CN';
|
|
| 62 |
// ===== Completion options (model select + max tokens) =====
|
| 63 |
const completionOptions = createCompletionOptionsRow({
|
| 64 |
isSkipChatTemplate: () => true,
|
| 65 |
-
metricModel: d3.select('#
|
| 66 |
alertDialogTitle: tr('Integrated Lab'),
|
| 67 |
onStateChange: () => syncSubmitButtonState(),
|
| 68 |
adminMode: () => adminManager.isInAdminMode(),
|
|
@@ -152,10 +152,16 @@ panels.activation.hidden = true;
|
|
| 152 |
// ===== Submit button =====
|
| 153 |
function syncSubmitButtonState(): void {
|
| 154 |
const text = promptTextarea.value.trim();
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
}
|
| 160 |
|
| 161 |
promptTextarea.addEventListener('input', () => {
|
|
@@ -275,7 +281,12 @@ async function onSelectedNodeChanged(nodeId: string | null): Promise<void> {
|
|
| 275 |
}
|
| 276 |
|
| 277 |
const step = findStepByNodeId(nodeId);
|
| 278 |
-
if (!step)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
|
| 280 |
selectedStep = step;
|
| 281 |
placeholderEl.style.display = 'none';
|
|
@@ -322,6 +333,10 @@ async function updateHighlightPanel(step: TokenGenStep): Promise<void> {
|
|
| 322 |
function renderHighlightFromAttribution(surface: HTMLElement, step: TokenGenStep): void {
|
| 323 |
surface.innerHTML = '';
|
| 324 |
const tokens = step.response.token_attribution ?? [];
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
const maxScore = Math.max(...tokens.map(t => Math.abs(t.score)), 0.001);
|
| 326 |
|
| 327 |
const container = document.createElement('div');
|
|
@@ -341,6 +356,11 @@ function renderHighlightFromAttribution(surface: HTMLElement, step: TokenGenStep
|
|
| 341 |
|
| 342 |
// ===== Panel: Context Attribution =====
|
| 343 |
function updateAttributionPanel(step: TokenGenStep): void {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
if (!attributionInspector) {
|
| 345 |
attributionInspector = createAttributionInspector({
|
| 346 |
resultsRoot: d3.select('#integrated_attribution_surface'),
|
|
|
|
| 62 |
// ===== Completion options (model select + max tokens) =====
|
| 63 |
const completionOptions = createCompletionOptionsRow({
|
| 64 |
isSkipChatTemplate: () => true,
|
| 65 |
+
metricModel: d3.select('#integrated_model_select'),
|
| 66 |
alertDialogTitle: tr('Integrated Lab'),
|
| 67 |
onStateChange: () => syncSubmitButtonState(),
|
| 68 |
adminMode: () => adminManager.isInAdminMode(),
|
|
|
|
| 152 |
// ===== Submit button =====
|
| 153 |
function syncSubmitButtonState(): void {
|
| 154 |
const text = promptTextarea.value.trim();
|
| 155 |
+
if (inFlight) {
|
| 156 |
+
submitBtn.disabled = false;
|
| 157 |
+
submitBtn.classList.remove('inactive');
|
| 158 |
+
submitBtn.textContent = tr('Stop');
|
| 159 |
+
} else {
|
| 160 |
+
const ready = text.length > 0;
|
| 161 |
+
submitBtn.disabled = !ready;
|
| 162 |
+
submitBtn.classList.toggle('inactive', !ready);
|
| 163 |
+
submitBtn.textContent = tr('Start');
|
| 164 |
+
}
|
| 165 |
}
|
| 166 |
|
| 167 |
promptTextarea.addEventListener('input', () => {
|
|
|
|
| 281 |
}
|
| 282 |
|
| 283 |
const step = findStepByNodeId(nodeId);
|
| 284 |
+
if (!step) {
|
| 285 |
+
placeholderEl.style.display = '';
|
| 286 |
+
placeholderEl.querySelector('.empty-state-title')!.textContent = tr('Select a token');
|
| 287 |
+
placeholderEl.querySelector('.empty-state-description')!.textContent = tr('Click a generated node in the DAG to inspect it with all six lenses.');
|
| 288 |
+
return;
|
| 289 |
+
}
|
| 290 |
|
| 291 |
selectedStep = step;
|
| 292 |
placeholderEl.style.display = 'none';
|
|
|
|
| 333 |
function renderHighlightFromAttribution(surface: HTMLElement, step: TokenGenStep): void {
|
| 334 |
surface.innerHTML = '';
|
| 335 |
const tokens = step.response.token_attribution ?? [];
|
| 336 |
+
if (tokens.length === 0) {
|
| 337 |
+
surface.innerHTML = '<div class="ae-error">No attribution data for this token.</div>';
|
| 338 |
+
return;
|
| 339 |
+
}
|
| 340 |
const maxScore = Math.max(...tokens.map(t => Math.abs(t.score)), 0.001);
|
| 341 |
|
| 342 |
const container = document.createElement('div');
|
|
|
|
| 356 |
|
| 357 |
// ===== Panel: Context Attribution =====
|
| 358 |
function updateAttributionPanel(step: TokenGenStep): void {
|
| 359 |
+
const surface = document.getElementById('integrated_attribution_surface')!;
|
| 360 |
+
if (!step.response || !step.response.token_attribution || step.response.token_attribution.length === 0) {
|
| 361 |
+
surface.innerHTML = '<div class="ae-error">No attribution data for this token.</div>';
|
| 362 |
+
return;
|
| 363 |
+
}
|
| 364 |
if (!attributionInspector) {
|
| 365 |
attributionInspector = createAttributionInspector({
|
| 366 |
resultsRoot: d3.select('#integrated_attribution_surface'),
|
client/src/shared/prediction_attribution/causal_flow/genAttributeDagView.ts
CHANGED
|
@@ -1480,6 +1480,7 @@ export function initGenAttributeDagView(
|
|
| 1480 |
recursiveEdgeAnimation.stopPlayback();
|
| 1481 |
refreshNodeLinkHighlight();
|
| 1482 |
syncDagPlayButtonImpl();
|
|
|
|
| 1483 |
});
|
| 1484 |
}
|
| 1485 |
|
|
|
|
| 1480 |
recursiveEdgeAnimation.stopPlayback();
|
| 1481 |
refreshNodeLinkHighlight();
|
| 1482 |
syncDagPlayButtonImpl();
|
| 1483 |
+
onDagRefresh?.();
|
| 1484 |
});
|
| 1485 |
}
|
| 1486 |
|