Repository navigation
Expand file tree
/
Copy pathgraphify.js
More file actions
10 lines (10 loc) · 2.81 KB
/
Copy pathgraphify.js
File metadata and controls
10 lines (10 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
/* Public external Graphify runtime and job-scoped inference controls. */
'use strict';
const graphifyPreviousSettings=settingsForm;
settingsForm=function(){return graphifyPreviousSettings()+`<section class="science-settings"><h3>External Graphify</h3><p class="hint mt12">The Windows release includes the public Graphify 0.9.80 runtime. It builds the graph in a separate process, using your selected extraction model and reasoning level—including Codex / ChatGPT sign-in. No extra API key or Native extraction pass is used.</p><div class="form-grid mt12"><div><label for="s-graphify_timeout_seconds">Total extraction timeout, seconds</label><input id="s-graphify_timeout_seconds" type="number" min="10" max="7200" value="${state.settings.graphify_timeout_seconds||1200}"></div><div><label for="s-graphify_chunk_tokens">Graphify input chunk budget, approximate tokens</label><input id="s-graphify_chunk_tokens" type="number" min="500" max="16000" value="${state.settings.graphify_chunk_tokens||4000}"></div></div><div class="row mt12">${btn('Check Graphify runtime','graphify-check','check','small')}<span id="graphify-runtime-status" class="hint" aria-live="polite"></span></div><p class="hint mt12">Choose Graphify in Advanced limits & Graphify above. Leave its custom executable path empty for the included runtime. A custom path is used explicitly, never silently replaced. Requests count toward the GraphPaper job budget. Cancelling an in-flight provider request may still consume allowance.</p></section>`;};
const graphifyPreviousSave=saveSettings;
saveSettings=async function(){for(const k of ['graphify_timeout_seconds','graphify_chunk_tokens'])if($('#s-'+k))state.settings[k]=Number($('#s-'+k).value);await graphifyPreviousSave();};
const graphifyPreviousAction=handleAction;
handleAction=async function(el){if(el.dataset.action==='graphify-check'){await saveSettings();$('#graphify-runtime-status').textContent='Checking the runtime without a model call…';const status=await api('/graphify/status');$('#graphify-runtime-status').textContent=status.available?`Ready: Graphify ${status.version} (${status.selection}).`:status.error;return;}return graphifyPreviousAction(el);};
const graphifyPreviousDirection=directionHTML;
directionHTML=function(){let value=graphifyPreviousDirection();const p=state.p;if(!p)return value;const item=p.graph.nodes.find(n=>n.id===state.node)||p.graph.edges.find(e=>e.id===state.edge);if(item?.source_ids?.length){const block=`<div class="evidence-card mt12"><span class="caps">Source-file provenance</span><p class="hint mt12">Reported by Graphify; inspect the original before treating the relationship as evidence.</p><div class="row wrap mt12">${item.source_ids.map(id=>btn(id,'source','file','small',`data-id="${esc(id)}"`)).join('')}</div></div>`;value=value.replace(/<\/div><\/aside>$/,block+'</div></aside>');}return value;};