TokenTrace / client /src /attribution.html
cccmmd
chore: rename project to TokenTrace and set default language to Chinese
f25ae00
Raw
History Blame Contribute Delete
14 kB
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="attribution.css">
</head>
<body>
<main class="main_frame">
<section class="left_panel">
<div class="floating_content">
<!-- INCLUDE partials/app-header.html -->
<div class="chat-cached-history-bar">
<div class="semantic-search-input-wrapper chat-prompt-history-wrapper">
<button type="button" id="attribution_cached_history_btn" class="text-action-btn" data-i18n>Cached history</button>
<ul id="attribution_cached_history_dropdown" class="semantic-search-history-dropdown"></ul>
</div>
</div>
<section id="attribution_examples" class="page-examples-section"></section>
<section class="input-section">
<div class="chat-prompt-panel">
<div class="input-header">
<span data-i18n>Context</span>
<div class="text-action-buttons-top">
<div class="textarea-counter" id="context_count_display">
<span id="context_count_value">0</span> <span data-i18n>chars</span>
</div>
<button type="button" id="clear_context_btn" class="text-action-btn" data-i18n>Clear</button>
<button type="button" id="paste_context_btn" class="text-action-btn" data-i18n>Paste</button>
<button type="button" id="context_history_btn" class="text-action-btn" data-i18n>History</button>
</div>
</div>
<div class="textarea-wrapper chat-prompt-textarea-block">
<div class="semantic-search-input-wrapper chat-prompt-history-wrapper">
<textarea id="context_text"></textarea>
<ul id="context_history_dropdown" class="semantic-search-history-dropdown"></ul>
</div>
</div>
</div>
<div class="chat-prompt-panel attribution-target-panel">
<div class="input-header">
<span data-i18n>Target prediction</span>
<div class="text-action-buttons-top">
<div class="textarea-counter" id="target_count_display">
<span id="target_count_value">0</span> <span data-i18n>chars</span>
</div>
<button type="button" id="clear_target_btn" class="text-action-btn" data-i18n>Clear</button>
<button type="button" id="paste_target_btn" class="text-action-btn" data-i18n>Paste</button>
<button type="button" id="target_history_btn" class="text-action-btn" data-i18n>History</button>
</div>
</div>
<div class="textarea-wrapper chat-prompt-textarea-block">
<div class="semantic-search-input-wrapper chat-prompt-history-wrapper">
<textarea id="target_text"></textarea>
<ul id="target_history_dropdown" class="semantic-search-history-dropdown"></ul>
</div>
</div>
</div>
<div class="textarea-wrapper chat-prompt-actions-row">
<div class="semantic-submode-row chat-completion-options-row attribution-model-variant-row">
<span class="semantic-submode-group">
<label class="semantic-submode-label" for="attribution_model_variant" data-i18n>Model</label>
<select id="attribution_model_variant" class="semantic-submode-select" aria-label="Attribution model slot" data-i18n="aria-label">
<option value="base">base</option>
<option value="instruct">instruct</option>
</select>
</span>
<span class="semantic-submode-group">
<label class="semantic-submode-label" for="attribution_method" data-i18n>Method</label>
<select id="attribution_method" class="semantic-submode-select" aria-label="Attribution method" data-i18n="aria-label">
<option value="gradient" data-i18n>Gradient</option>
<option value="ablation" data-i18n>Ablation</option>
<option value="both" data-i18n>Both</option>
</select>
</span>
</div>
<div class="button-group">
<div class="button-left">
<div class="button-left-primary">
<button type="button" id="analyze_btn" class="primary-btn inactive" disabled data-i18n>Analyze attribution</button>
<div class="loadersmall loader-small-container"></div>
</div>
</div>
<div id="attribution_result_info" class="text-metrics is-hidden"></div>
<div class="button-right">
<button type="button" id="force_retry_btn" class="primary-btn inactive" disabled title="Fetch again without using cached result" data-i18n="text,title">Force retry</button>
</div>
</div>
</div>
<div class="semantic-submode-row attribution-max-score-row">
<span class="semantic-submode-group">
<label class="attribution-use-mapping-label">
<input type="checkbox" id="attribution_use_mapping">
<span></span>
</label>
</span>
<span class="semantic-submode-group attribution-max-score-slider-group">
<label class="semantic-submode-label" for="attribution_max_score_range" data-i18n>Max score</label>
<input type="range" id="attribution_max_score_range" class="attribution-max-score-range"
min="0.01" max="1" step="0.01" value="1"
title="For threshold x∈(0,1]: map normalized scores in [0,x] linearly to display intensities [0,1]; scores above x saturate at maximum intensity. At x=1, equivalent to disabling mapping."
data-i18n="title"
disabled>
<span id="attribution_max_score_value" class="attribution-max-score-value" aria-live="polite">1.00</span>
</span>
</div>
<div class="attribution-exclude-prompt-patterns-row">
<div class="semantic-submode-row attribution-exclude-prompt-patterns-header">
<span class="semantic-submode-group">
<label class="attribution-use-mapping-label"
title="When enabled, each line below is a regex with the global flag, matched only within the context field below. If a token offset lies fully inside a match, its score is treated as 0."
data-i18n="title">
<input type="checkbox" id="attribution_exclude_prompt_patterns_enable" checked>
<span></span>
</label>
</span>
<span class="semantic-submode-group">
<label class="semantic-submode-label" for="attribution_exclude_prompt_patterns" data-i18n>Exclude prompt patterns</label>
</span>
</div>
<textarea id="attribution_exclude_prompt_patterns" class="attribution-exclude-prompt-patterns-input" rows="1"
placeholder="One regex per line (context only)"
spellcheck="false"
autocomplete="off"
title="One regex per line (global flag), matched only within the context text; if a token offset lies fully inside a match, its score is treated as 0."
data-i18n="placeholder,title"></textarea>
</div>
</section>
</div>
</section>
<div class="resizer" id="resizer"></div>
<section class="right_panel">
<div class="empty-state empty-state-dashed">
<svg class="empty-state-icon" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<circle cx="24" cy="24" r="16"/>
<path d="M24 8 L24 40 M8 24 L40 24"/>
<circle cx="24" cy="24" r="6"/>
</svg>
<div class="empty-state-title" data-i18n>No attribution yet</div>
<div class="empty-state-description" data-i18n>Enter context and target text on the left, then click Analyze to see which words drive the prediction.</div>
</div>
<div class="attribution-method-panels">
<div class="attribution-gradient-panel">
<div class="attribution-panel-label" data-i18n>Gradient</div>
<div id="results" class="attribution-inspector-surface">
<div id="major_tooltip" class="tooltip">
<div class="currentToken"></div>
<div class="myDetail"></div>
<br />
<div class="predictions predictions-table"></div>
</div>
</div>
<div id="attribution_debug_container"></div>
</div>
<div class="attribution-ablation-panel">
<div class="attribution-panel-label" data-i18n>Ablation</div>
<div id="ablation_results" class="attribution-inspector-surface">
<div id="ablation_major_tooltip" class="tooltip">
<div class="currentToken"></div>
<div class="myDetail"></div>
<br />
<div class="predictions predictions-table"></div>
</div>
</div>
<div id="ablation_debug_container"></div>
<div class="attribution-ablation-disclaimer" data-i18n>
Occlusion-based causal attribution. Positive = supports target; negative = suppresses target.
</div>
</div>
</div>
<div id="attribution_both_legend" class="attribution-both-legend" style="display:none;">
<span class="attribution-legend-item">
<span class="attribution-legend-swatch attribution-legend-positive"></span>
<span data-i18n>Supports target</span>
</span>
<span class="attribution-legend-item">
<span class="attribution-legend-swatch attribution-legend-negative"></span>
<span data-i18n>Suppresses target</span>
</span>
<span class="attribution-legend-item">
<span class="attribution-legend-swatch attribution-legend-neutral"></span>
<span data-i18n>Neutral</span>
</span>
</div>
<div id="attribution_consistency_readout" class="attribution-consistency-readout"></div>
<div class="attr-ae-panel" id="attr_ae_panel" style="display:none;">
<div class="attribution-panel-label" data-i18n>Activation Explainer</div>
<div class="ae-trigger-row">
<span class="ae-trigger-hint" data-i18n>Click a context token above, then explain its activation</span>
<button type="button" id="attr_ae_trigger" class="text-action-btn" disabled data-i18n>Explain activation</button>
</div>
<div id="attr_ae_loading" class="ae-loading" style="display:none" data-i18n>Loading activation explanation…</div>
<div id="attr_ae_result" class="ae-result" style="display:none">
<div class="ae-field"><span class="ae-label" data-i18n>Explanation</span><span id="attr_ae_explanation" class="ae-value"></span></div>
<div class="ae-field"><span class="ae-label" data-i18n>Confidence</span><span id="attr_ae_cosine" class="ae-cosine"></span><span>&nbsp;(roundtrip cosine)</span></div>
</div>
<div id="attr_ae_error" class="ae-error" style="display:none"></div>
</div>
</section>
</main>
<div id="toast" class="toast"></div>
<script src="vendor.js"></script>
<script src="attribution.js"></script>
</body>
</html>