99; ============================================================================
1010
1111#define MyAppName " Shineos Local AI"
12- #define MyAppVersion " 1.0.24 "
12+ #define MyAppVersion " 1.0.25 "
1313#define MyAppPublisher " Shineos Inc."
1414#define MyAppURL " https://shineos.com"
1515#define MyAppExeName " open-webui.exe"
8585 PortFree: Boolean;
8686 OsOk: Boolean;
8787 SelectedModel: String;
88+ UninstallRemoveOllama: Boolean;
8889
8990const
9091 PREFLIGHT_INI = ' preflight.ini' ;
@@ -315,6 +316,49 @@ end;
315316
316317{ ---------- アンインストール ---------- }
317318
319+ { アンインストール開始時に「Ollama・モデルも削除するか」を確認する }
320+ function InitializeUninstall : Boolean;
321+ begin
322+ Result := True;
323+ UninstallRemoveOllama := False;
324+ if not UninstallSilent then
325+ UninstallRemoveOllama := MsgBox(
326+ ' Ollama(LLM実行エンジン)とダウンロード済みAIモデル(約3.2GB)も削除しますか?' + #13 #10 + #13 #10 +
327+ ' 「はい」: Ollama本体・AIモデル・関連サービスをすべて削除します。' + #13 #10 +
328+ ' 再インストール時はOllamaとモデルの再ダウンロード(約2時間)が必要です。' + #13 #10 +
329+ ' 「いいえ」: Shineos Local AI のファイルとサービスだけを削除し、Ollama は残します。' ,
330+ mbConfirmation, MB_YESNO) = IDYES;
331+ end ;
332+
333+ { Ollama 本体・モデル・サービスを完全削除する }
334+ procedure RemoveOllamaCompletely ;
335+ var
336+ RC: Integer;
337+ OllamaUnins: String;
338+ begin
339+ { 実行中のプロセスを停止(直接起動・トレイアプリ) }
340+ Exec(' taskkill.exe' , ' /IM ollama.exe /F' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
341+ Exec(' taskkill.exe' , ' /IM "ollama app.exe" /F' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
342+
343+ { 公式サービスとフォールバックサービスを停止・削除 }
344+ Exec(ExpandConstant(' {sys}\sc.exe' ), ' stop Ollama' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
345+ Exec(ExpandConstant(' {sys}\sc.exe' ), ' delete Ollama' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
346+ Exec(ExpandConstant(' {sys}\sc.exe' ), ' stop ShineosOllama' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
347+ Exec(ExpandConstant(' {sys}\sc.exe' ), ' delete ShineosOllama' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
348+
349+ { 公式アンインストーラで Ollama 本体を削除(Inno製のため unins000.exe が存在する) }
350+ OllamaUnins := ExpandConstant(' {localappdata}\Programs\Ollama\unins000.exe' );
351+ if FileExists(OllamaUnins) then
352+ begin
353+ Exec(OllamaUnins, ' /VERYSILENT /SUPPRESSMSGBOXES /NORESTART' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
354+ end ;
355+
356+ { 残ったモデル・データ・プログラムを確実に削除 }
357+ DelTree(ExpandConstant(' {userprofile}\.ollama' ), True, True, True);
358+ DelTree(ExpandConstant(' {localappdata}\Programs\Ollama' ), True, True, True);
359+ DelTree(ExpandConstant(' {appdata}\Ollama' ), True, True, True);
360+ end ;
361+
318362procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
319363var
320364 RC: Integer;
@@ -324,8 +368,13 @@ begin
324368 { サービス停止 → 削除(ファイル削除前に実行される) }
325369 Exec(ExpandConstant(' {sys}\sc.exe' ), ' stop ShineosLocalAI' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
326370 Exec(ExpandConstant(' {sys}\sc.exe' ), ' delete ShineosLocalAI' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
327- { Ollama のサービス不在時に登録したフォールバックサービスの削除 }
328- Exec(ExpandConstant(' {sys}\sc.exe' ), ' stop ShineosOllama' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
329- Exec(ExpandConstant(' {sys}\sc.exe' ), ' delete ShineosOllama' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
371+ if UninstallRemoveOllama then
372+ RemoveOllamaCompletely
373+ else
374+ begin
375+ { Ollama を残す場合はフォールバックサービスのみ削除 }
376+ Exec(ExpandConstant(' {sys}\sc.exe' ), ' stop ShineosOllama' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
377+ Exec(ExpandConstant(' {sys}\sc.exe' ), ' delete ShineosOllama' , ' ' , SW_HIDE, ewWaitUntilTerminated, RC);
378+ end ;
330379 end ;
331380end ;
0 commit comments