Merge pull request #2516 from dhiltgen/single_tray_app
Fix a couple duplicate instance bugs
This commit is contained in:
commit
c3e62ba38a
6 changed files with 11 additions and 9 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/jmorganca/ollama/app/store"
|
"github.com/jmorganca/ollama/app/store"
|
||||||
"github.com/jmorganca/ollama/app/tray"
|
"github.com/jmorganca/ollama/app/tray"
|
||||||
|
@ -58,8 +59,8 @@ func Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if IsServerRunning(ctx) {
|
if IsServerRunning(ctx) {
|
||||||
slog.Debug("XXX detected server already running")
|
slog.Info("Detected another instance of ollama running, exiting")
|
||||||
// TODO - should we fail fast, try to kill it, or just ignore?
|
os.Exit(1)
|
||||||
} else {
|
} else {
|
||||||
done, err = SpawnServer(ctx, CLIName)
|
done, err = SpawnServer(ctx, CLIName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -48,7 +48,8 @@ func DoUpgrade(cancel context.CancelFunc, done chan int) error {
|
||||||
if done != nil {
|
if done != nil {
|
||||||
<-done
|
<-done
|
||||||
} else {
|
} else {
|
||||||
slog.Warn("XXX done chan was nil, not actually waiting")
|
// Shouldn't happen
|
||||||
|
slog.Warn("done chan was nil, not actually waiting")
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Debug(fmt.Sprintf("starting installer: %s %v", installerExe, installArgs))
|
slog.Debug(fmt.Sprintf("starting installer: %s %v", installerExe, installArgs))
|
||||||
|
|
|
@ -80,6 +80,8 @@ SignTool=MySignTool
|
||||||
SignedUninstaller=yes
|
SignedUninstaller=yes
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SetupMutex=OllamaSetupMutex
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||||
|
|
||||||
|
@ -120,6 +122,8 @@ Type: filesandordirs; Name: "{%USERPROFILE}\.ollama"
|
||||||
[Messages]
|
[Messages]
|
||||||
WizardReady=Ollama Windows Preview
|
WizardReady=Ollama Windows Preview
|
||||||
ReadyLabel1=%nLet's get you up and running with your own large language models.
|
ReadyLabel1=%nLet's get you up and running with your own large language models.
|
||||||
|
SetupAppRunningError=Another Ollama installer is running.%n%nPlease cancel or finish the other installer, then click OK to continue with this install, or Cancel to exit.
|
||||||
|
|
||||||
|
|
||||||
;FinishedHeadingLabel=Run your first model
|
;FinishedHeadingLabel=Run your first model
|
||||||
;FinishedLabel=%nRun this command in a PowerShell or cmd terminal.%n%n%n ollama run llama2
|
;FinishedLabel=%nRun this command in a PowerShell or cmd terminal.%n%n%n ollama run llama2
|
||||||
|
|
|
@ -45,7 +45,6 @@ func nativeLoop() {
|
||||||
case 0:
|
case 0:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
// slog.Debug(fmt.Sprintf("XXX dispatching message from run loop 0x%x", m.Message))
|
|
||||||
pTranslateMessage.Call(uintptr(unsafe.Pointer(m))) //nolint:errcheck
|
pTranslateMessage.Call(uintptr(unsafe.Pointer(m))) //nolint:errcheck
|
||||||
pDispatchMessage.Call(uintptr(unsafe.Pointer(m))) //nolint:errcheck
|
pDispatchMessage.Call(uintptr(unsafe.Pointer(m))) //nolint:errcheck
|
||||||
|
|
||||||
|
@ -66,11 +65,9 @@ func (t *winTray) wndProc(hWnd windows.Handle, message uint32, wParam, lParam ui
|
||||||
WM_MOUSEMOVE = 0x0200
|
WM_MOUSEMOVE = 0x0200
|
||||||
WM_LBUTTONDOWN = 0x0201
|
WM_LBUTTONDOWN = 0x0201
|
||||||
)
|
)
|
||||||
// slog.Debug(fmt.Sprintf("XXX in wndProc: 0x%x", message))
|
|
||||||
switch message {
|
switch message {
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
menuItemId := int32(wParam)
|
menuItemId := int32(wParam)
|
||||||
// slog.Debug(fmt.Sprintf("XXX Menu Click: %d", menuItemId))
|
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/menurc/wm-command#menus
|
// https://docs.microsoft.com/en-us/windows/win32/menurc/wm-command#menus
|
||||||
switch menuItemId {
|
switch menuItemId {
|
||||||
case quitMenuID:
|
case quitMenuID:
|
||||||
|
@ -151,7 +148,6 @@ func (t *winTray) wndProc(hWnd windows.Handle, message uint32, wParam, lParam ui
|
||||||
slog.Debug(fmt.Sprintf("unmanaged app message, lParm: 0x%x", lParam))
|
slog.Debug(fmt.Sprintf("unmanaged app message, lParm: 0x%x", lParam))
|
||||||
}
|
}
|
||||||
case t.wmTaskbarCreated: // on explorer.exe restarts
|
case t.wmTaskbarCreated: // on explorer.exe restarts
|
||||||
slog.Debug("XXX got taskbar created event")
|
|
||||||
t.muNID.Lock()
|
t.muNID.Lock()
|
||||||
err := t.nid.add()
|
err := t.nid.add()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -161,7 +157,6 @@ func (t *winTray) wndProc(hWnd windows.Handle, message uint32, wParam, lParam ui
|
||||||
default:
|
default:
|
||||||
// Calls the default window procedure to provide default processing for any window messages that an application does not process.
|
// Calls the default window procedure to provide default processing for any window messages that an application does not process.
|
||||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms633572(v=vs.85).aspx
|
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms633572(v=vs.85).aspx
|
||||||
// slog.Debug(fmt.Sprintf("XXX default wndProc handler 0x%x", message))
|
|
||||||
lResult, _, _ = pDefWindowProc.Call(
|
lResult, _, _ = pDefWindowProc.Call(
|
||||||
uintptr(hWnd),
|
uintptr(hWnd),
|
||||||
uintptr(message),
|
uintptr(message),
|
||||||
|
|
|
@ -14,7 +14,7 @@ As this is a preview release, you should expect a few bugs here and there. If
|
||||||
you run into a problem you can reach out on
|
you run into a problem you can reach out on
|
||||||
[Discord](https://discord.gg/ollama), or file an
|
[Discord](https://discord.gg/ollama), or file an
|
||||||
[issue](https://github.com/ollama/ollama/issues).
|
[issue](https://github.com/ollama/ollama/issues).
|
||||||
Logs will be often be helpful in dianosing the problem (see
|
Logs will often be helpful in dianosing the problem (see
|
||||||
[Troubleshooting](#troubleshooting) below)
|
[Troubleshooting](#troubleshooting) below)
|
||||||
|
|
||||||
## System Requirements
|
## System Requirements
|
||||||
|
|
|
@ -60,6 +60,7 @@ function buildOllama() {
|
||||||
/csp "Google Cloud KMS Provider" /kc ${env:KEY_CONTAINER} ollama.exe
|
/csp "Google Cloud KMS Provider" /kc ${env:KEY_CONTAINER} ollama.exe
|
||||||
if ($LASTEXITCODE -ne 0) { exit($LASTEXITCODE)}
|
if ($LASTEXITCODE -ne 0) { exit($LASTEXITCODE)}
|
||||||
}
|
}
|
||||||
|
cp .\ollama.exe .\dist\ollama-windows-amd64.exe
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildApp() {
|
function buildApp() {
|
||||||
|
|
Loading…
Reference in a new issue