PageSourceSearch

https://jayreddinjr-jr-odysseus-hf.hf.space/static/js/compare/state.js

js jayreddinjr-jr-odysseus-hf.hf.space collected 2026-10-04 17:00:13 UTC 2,752 bytes, 58 lines download raw bytes

1// compare/state.js — shared mutable state for compare modules
2const state = {
3  API_BASE: '',
4  isActive: false,
5  _openingSelector: false,        // prevents duplicate compare modals on rapid re-clicks
6  _streaming: false,
7  _blindMode: true,
8  _saveOnClose: false,
9  _continueChat: false,
10  _timeout: 300,                   // seconds
11  _finishOrder: 0,
12  _paneElapsed: [],                // per-pane total ms; populated on finish so the
13                                   // Fastest badge can be awarded by actual time
14                                   // (sequential mode otherwise always picks pane 1)
15  _selectedModels: [],             // [{model, endpoint, endpointId, name}, ...]
16  _paneSessionIds: [],             // session IDs for each pane
17  _paneMetrics: [],                // metrics per pane from last round
18  _abortControllers: [],           // per-pane abort controllers
19  _sidebarWasHidden: false,
20  _compareElements: [],            // elements we added to container (for cleanup)
21  _savedToggles: null,             // tool toggle states saved before compare
22  _savedIndicatorDisplay: {},      // display state of toolbar indicators before compare
23  _savedMode: 'chat',              // agent/chat mode saved before compare
24  _hasVisibleResults: false,       // compare results still on screen after close
25  _compareMode: 'chat',            // 'chat', 'agent', 'search', or 'research'
26  _lastPrompt: '',                 // last prompt sent (for rematch)
27  _cachedModels: [],               // cached model list for pane dropdowns
28  _probed: new Set(),              // model IDs that have been successfully probed
29  _cachedProviders: null,          // cached search providers for search mode
30  _searchSynthModels: null,        // per-pane synthesis models for search mode
31  _parallel: true,                 // true = run all panes at once, false = one at a time
32  _fetchModelsCache: null,
33  _fetchModelsCacheTime: 0,
34  _expectedAnswer: '',             // when an eval prompt with `answer` is picked,
35                                   // stream.js reads this and stamps ✓/✗ per pane
36};
37
38/** Reset transient state to defaults — useful for clean restarts. */
39export function reset() {
40  state._openingSelector = false;
41  state._streaming = false;
42  state._finishOrder = 0;
43  state._paneElapsed = [];
44  state._abortControllers.forEach(c => { if (c) c.abort(); });
45  state._abortControllers = [];
46  state._paneSessionIds = [];
47  state._paneMetrics = [];
48  state._compareElements = [];
49  state._hasVisibleResults = false;
50  state._lastPrompt = '';
51  state._cachedModels = [];
52  state._probed = new Set();
53  state._cachedProviders = null;
54  state._fetchModelsCache = null;
55  state._fetchModelsCacheTime = 0;
56}
57
58export default state;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.