File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ public class LLM : LLMClient
54
54
private ManualResetEvent serverBlock = new ManualResetEvent ( false ) ;
55
55
static object crashKillLock = new object ( ) ;
56
56
static bool crashKill = false ;
57
+ private string keyfile = "" ;
57
58
58
59
#if UNITY_EDITOR
59
60
[ InitializeOnLoadMethod ]
@@ -222,6 +223,7 @@ private void CheckIfListening(string message)
222
223
{
223
224
// Read the output of the llm binary and check if the server has been started and listening
224
225
DebugLog ( message ) ;
226
+ if ( keyfile != "" && File . Exists ( keyfile ) ) File . Delete ( keyfile ) ;
225
227
if ( serverListening ) return ;
226
228
try
227
229
{
@@ -252,8 +254,19 @@ private string EscapeSpaces(string input)
252
254
253
255
private void RunServerCommand ( string exe , string args )
254
256
{
257
+ string passwordArgs = "" ;
258
+ if ( password != "" )
259
+ {
260
+ keyfile = Path . Combine ( Application . temporaryCachePath , Path . GetTempFileName ( ) ) ;
261
+ using ( StreamWriter writer = new StreamWriter ( keyfile ) )
262
+ {
263
+ writer . WriteLine ( password ) ;
264
+ }
265
+ passwordArgs = $ " --api-key-file { keyfile } ";
266
+ }
267
+
255
268
string binary = exe ;
256
- string arguments = args ;
269
+ string arguments = args + passwordArgs ;
257
270
if ( Application . platform == RuntimePlatform . LinuxEditor || Application . platform == RuntimePlatform . LinuxPlayer )
258
271
{
259
272
// use APE binary directly if on Linux
You can’t perform that action at this time.
0 commit comments