@@ -29,7 +29,7 @@ const modelTemplateSelect = document.querySelector("#modelTemplateSelect");
2929const modelTemplateButton = document . querySelector ( "#modelTemplateButton" ) ;
3030const pythonInterpreterSelect = document . querySelector ( "#pythonInterpreterSelect" ) ;
3131const pythonInterpreterInput = document . querySelector ( "#pythonInterpreterInput" ) ;
32- const pythonTestButton = document . querySelector ( "#pythonTestButton " ) ;
32+ const pythonInterpreterSaveButton = document . querySelector ( "#pythonInterpreterSaveButton " ) ;
3333const pythonTestStatus = document . querySelector ( "#pythonTestStatus" ) ;
3434const showApiKeyToggle = document . querySelector ( "#showApiKeyToggle" ) ;
3535const settingsWizardButton = document . querySelector ( "#settingsWizardButton" ) ;
@@ -130,6 +130,7 @@ let batchOutputRows = [];
130130let batchCurrentPage = 1 ;
131131const batchPageSize = 10 ;
132132let batchSelectedIndex = null ;
133+ let batchTableRenderTimer = null ;
133134let activeBatchVar = "" ;
134135
135136const editorRegistry = new Map ( ) ;
@@ -454,7 +455,7 @@ const translations = {
454455 Delete : "Delete" ,
455456 Remove : "Remove" ,
456457 "Add Field" : "Add Field" ,
457- "Save Settings" : "Save Settings" ,
458+ "Save Model Settings" : "Save Model Settings" ,
458459 Console : "Console" ,
459460 Reset : "Reset" ,
460461 "model name" : "model name" ,
@@ -486,6 +487,7 @@ const translations = {
486487 Testing : "Testing..." ,
487488 OK : "OK" ,
488489 "Install Hint" : "If your interpreter does not have Agently installed, run:" ,
490+ "Test And Save Interpreter" : "Test And Save Interpreter" ,
489491 "Reset Settings And Use Wizard" : "Reset Settings And Use Wizard" ,
490492 "Reset Settings Confirm" : "This will reset all settings and reopen the wizard. Continue?" ,
491493 } ,
@@ -560,7 +562,7 @@ const translations = {
560562 Delete : "删除" ,
561563 Remove : "移除" ,
562564 "Add Field" : "添加字段" ,
563- "Save Settings" : "保存设置 " ,
565+ "Save Model Settings" : "保存模型设置 " ,
564566 Console : "控制台" ,
565567 Reset : "重置" ,
566568 "model name" : "模型名称" ,
@@ -569,8 +571,7 @@ const translations = {
569571 "Python Interpreter" : "Python 解释器" ,
570572 "Custom Path" : "自定义路径" ,
571573 "/usr/bin/python3" : "/usr/bin/python3" ,
572- "Interpreter Test" : "解释器测试" ,
573- "Test Interpreter" : "测试解释器" ,
574+ "Test And Save Interpreter" : "测试并保存解释器" ,
574575 "Testing interpreter..." : "正在测试解释器..." ,
575576 "Interpreter OK" : "解释器可用" ,
576577 "Interpreter test failed" : "解释器测试失败" ,
@@ -909,6 +910,7 @@ function switchBatchOutputTab(target) {
909910 batchOutputPanels . forEach ( ( panel ) =>
910911 panel . classList . toggle ( "active" , panel . dataset . batchOutputPanel === target ) ,
911912 ) ;
913+ renderBatchDetail ( ) ;
912914 autoResizeAllOutputs ( ) ;
913915 const panel = document . querySelector ( `[data-batch-output-panel="${ target } "] textarea` ) ;
914916 if ( panel ) {
@@ -920,6 +922,7 @@ function switchBatchPromptTab(target) {
920922 batchPromptPanels . forEach ( ( panel ) =>
921923 panel . classList . toggle ( "active" , panel . dataset . batchPromptPanel === target ) ,
922924 ) ;
925+ renderBatchDetail ( ) ;
923926 autoResizeAllOutputs ( ) ;
924927}
925928
@@ -1307,6 +1310,16 @@ function renderBatchTable() {
13071310 renderBatchDetail ( ) ;
13081311}
13091312
1313+ function scheduleBatchTableRender ( ) {
1314+ if ( batchTableRenderTimer ) {
1315+ return ;
1316+ }
1317+ batchTableRenderTimer = setTimeout ( ( ) => {
1318+ batchTableRenderTimer = null ;
1319+ renderBatchTable ( ) ;
1320+ } , 120 ) ;
1321+ }
1322+
13101323function renderBatchDetail ( ) {
13111324 if (
13121325 ! batchDetailTitle ||
@@ -1907,8 +1920,8 @@ if (showApiKeyToggle) {
19071920 } ) ;
19081921}
19091922
1910- if ( pythonTestButton ) {
1911- pythonTestButton . addEventListener ( "click" , async ( ) => {
1923+ if ( pythonInterpreterSaveButton ) {
1924+ pythonInterpreterSaveButton . addEventListener ( "click" , async ( ) => {
19121925 if ( ! window . agentlyApi ?. testPythonInterpreter ) {
19131926 return ;
19141927 }
@@ -1917,14 +1930,16 @@ if (pythonTestButton) {
19171930 if ( pythonTestStatus ) {
19181931 pythonTestStatus . textContent = testingLabel ;
19191932 }
1920- pythonTestButton . disabled = true ;
1933+ pythonInterpreterSaveButton . disabled = true ;
19211934 const result = await window . agentlyApi . testPythonInterpreter ( path ) ;
19221935 if ( result ?. ok ) {
19231936 const okLabel = translations [ languageSelect . value ] ?. [ "Interpreter OK" ] || "Interpreter OK" ;
1924- const message = result . version ? ` ${ okLabel } : ${ result . version } ` : okLabel ;
1937+ const message = okLabel ;
19251938 if ( pythonTestStatus ) {
19261939 pythonTestStatus . textContent = message ;
19271940 }
1941+ settingsCache . pythonInterpreter = path ;
1942+ await saveSettings ( ) ;
19281943 } else {
19291944 const failedLabel = translations [ languageSelect . value ] ?. [ "Interpreter test failed" ]
19301945 || "Interpreter test failed" ;
@@ -1933,7 +1948,7 @@ if (pythonTestButton) {
19331948 pythonTestStatus . textContent = message ;
19341949 }
19351950 }
1936- pythonTestButton . disabled = false ;
1951+ pythonInterpreterSaveButton . disabled = false ;
19371952 } ) ;
19381953}
19391954
@@ -2198,15 +2213,15 @@ function bindBatchStream() {
21982213 row . promptJson = data . jsonPrompt || "" ;
21992214 row . promptPython = data . pythonExample || "" ;
22002215 }
2201- renderBatchTable ( ) ;
2216+ scheduleBatchTableRender ( ) ;
22022217 return ;
22032218 }
22042219 if ( data . type === "task_start" ) {
22052220 const row = batchOutputRows . find ( ( item ) => item . index === data . index + 1 ) ;
22062221 if ( row ) {
22072222 row . status = "running" ;
22082223 }
2209- renderBatchTable ( ) ;
2224+ scheduleBatchTableRender ( ) ;
22102225 return ;
22112226 }
22122227 if ( data . type === "stream" ) {
@@ -2222,7 +2237,7 @@ function bindBatchStream() {
22222237 if ( batchSelectedIndex === data . index + 1 ) {
22232238 renderBatchDetail ( ) ;
22242239 }
2225- renderBatchTable ( ) ;
2240+ scheduleBatchTableRender ( ) ;
22262241 return ;
22272242 }
22282243 if ( data . type === "console" ) {
@@ -2233,7 +2248,7 @@ function bindBatchStream() {
22332248 if ( batchSelectedIndex === data . index + 1 ) {
22342249 renderBatchDetail ( ) ;
22352250 }
2236- renderBatchTable ( ) ;
2251+ scheduleBatchTableRender ( ) ;
22372252 return ;
22382253 }
22392254 if ( data . type === "console_delta" ) {
@@ -2244,7 +2259,7 @@ function bindBatchStream() {
22442259 if ( batchSelectedIndex === data . index + 1 ) {
22452260 renderBatchDetail ( ) ;
22462261 }
2247- renderBatchTable ( ) ;
2262+ scheduleBatchTableRender ( ) ;
22482263 return ;
22492264 }
22502265 if ( data . type === "final" ) {
@@ -2260,7 +2275,7 @@ function bindBatchStream() {
22602275 if ( batchSelectedIndex === data . index + 1 ) {
22612276 renderBatchDetail ( ) ;
22622277 }
2263- renderBatchTable ( ) ;
2278+ scheduleBatchTableRender ( ) ;
22642279 return ;
22652280 }
22662281 if ( data . type === "error" ) {
@@ -2276,7 +2291,7 @@ function bindBatchStream() {
22762291 if ( batchSelectedIndex === data . index + 1 ) {
22772292 renderBatchDetail ( ) ;
22782293 }
2279- renderBatchTable ( ) ;
2294+ scheduleBatchTableRender ( ) ;
22802295 return ;
22812296 }
22822297 if ( data . type === "done" ) {
0 commit comments