Skip to content

Commit 7b71637

Browse files
committed
Fixups
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent 94c3165 commit 7b71637

File tree

4 files changed

+39
-34
lines changed

4 files changed

+39
-34
lines changed

.github/workflows/build-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
go-version: 1.23
3535
- name: Build launcher for macOS ARM64
3636
run: |
37-
make create-dmg
37+
make build-launcher-darwin
3838
ls -liah dist
3939
- name: Upload macOS launcher artifacts
4040
uses: actions/upload-artifact@v4

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ jobs:
3737
go-version: 1.23
3838
- name: Build launcher for macOS ARM64
3939
run: |
40-
make create-dmg
40+
make build-launcher-darwin
4141
- name: Upload DMG to Release
4242
uses: actions/upload-release-asset@v1
4343
env:
4444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4545
with:
4646
url: ${{ github.event.release.upload_url }}
4747
asset_path: ./dist/LocalAI-Launcher.dmg
48-
asset_name: LocalAI-Launcher.dmg
48+
asset_name: LocalAI.dmg
4949
asset_content_type: application/octet-stream
5050
launcher-build-linux:
5151
runs-on: ubuntu-latest

Makefile

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -516,22 +516,13 @@ docs: docs/static/gallery.html
516516
########################################################
517517

518518
## fyne cross-platform build
519-
build-launcher-darwin:
520-
cd cli/launcher && go run fyne.io/tools/cmd/fyne@latest package -os darwin -icon ../../core/http/static/logo.png --executable $(LAUNCHER_BINARY_NAME)-darwin && mv launcher.app ../../$(LAUNCHER_BINARY_NAME)-darwin.app
519+
build-launcher-darwin: build-launcher
520+
go run github.com/tiagomelo/macos-dmg-creator/cmd/createdmg@latest \
521+
--appName "LocalAI" \
522+
--appBinaryPath "$(LAUNCHER_BINARY_NAME)" \
523+
--bundleIdentifier "com.localai.launcher" \
524+
--iconPath "core/http/static/logo.png" \
525+
--outputDir "dist/"
521526

522527
build-launcher-linux:
523-
cd cli/launcher && go run fyne.io/tools/cmd/fyne@latest package -os linux -icon ../../core/http/static/logo.png --executable $(LAUNCHER_BINARY_NAME)-linux && mv launcher.tar.xz ../../$(LAUNCHER_BINARY_NAME)-linux.tar.xz
524-
525-
# macOS DMG creation (requires macOS)
526-
create-dmg: build-launcher-darwin ## Create macOS DMG
527-
ifeq ($(OS),Darwin)
528-
@echo "Creating macOS DMG package..."
529-
mkdir -p dist/LocalAI-Launcher
530-
cp -rfv $(LAUNCHER_BINARY_NAME)-darwin.app dist/LocalAI-Launcher/LocalAI-Launcher
531-
ln -sf /Applications dist/LocalAI-Launcher/Applications
532-
hdiutil create -volname "LocalAI Launcher" -srcfolder dist/LocalAI-Launcher -ov -format UDZO dist/LocalAI-Launcher.dmg
533-
rm -rf dist/LocalAI-Launcher
534-
@echo "DMG created: dist/LocalAI-Launcher.dmg"
535-
else
536-
@echo "DMG creation requires macOS"
537-
endif
528+
cd cli/launcher && go run fyne.io/tools/cmd/fyne@latest package -os linux -icon ../../core/http/static/logo.png --executable $(LAUNCHER_BINARY_NAME)-linux && mv launcher.tar.xz ../../$(LAUNCHER_BINARY_NAME)-linux.tar.xz

core/launcher/launcher.go

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,13 @@ func (l *Launcher) Initialize() error {
155155
// Check if LocalAI is installed
156156
if !l.releaseManager.IsLocalAIInstalled() {
157157
log.Printf("No LocalAI installation found")
158-
l.updateStatus("No LocalAI installation found")
159-
if l.ui != nil {
160-
// Show dialog offering to download LocalAI
161-
l.showDownloadLocalAIDialog()
162-
}
158+
fyne.Do(func() {
159+
l.updateStatus("No LocalAI installation found")
160+
if l.ui != nil {
161+
// Show dialog offering to download LocalAI
162+
l.showDownloadLocalAIDialog()
163+
}
164+
})
163165
}
164166

165167
// Check for updates periodically
@@ -226,8 +228,10 @@ func (l *Launcher) StartLocalAI() error {
226228
}
227229

228230
l.isRunning = true
229-
l.updateStatus("LocalAI is starting...")
230-
l.updateRunningState(true)
231+
fyne.Do(func() {
232+
l.updateStatus("LocalAI is starting...")
233+
l.updateRunningState(true)
234+
})
231235

232236
// Start log monitoring
233237
go l.monitorLogs(stdout, "STDOUT")
@@ -238,11 +242,17 @@ func (l *Launcher) StartLocalAI() error {
238242
// Wait for process to start or fail
239243
err := l.localaiCmd.Wait()
240244
l.isRunning = false
241-
l.updateRunningState(false)
245+
fyne.Do(func() {
246+
l.updateRunningState(false)
247+
})
242248
if err != nil {
243-
l.updateStatus(fmt.Sprintf("LocalAI stopped with error: %v", err))
249+
fyne.Do(func() {
250+
l.updateStatus(fmt.Sprintf("LocalAI stopped with error: %v", err))
251+
})
244252
} else {
245-
l.updateStatus("LocalAI stopped")
253+
fyne.Do(func() {
254+
l.updateStatus("LocalAI stopped")
255+
})
246256
}
247257
}()
248258

@@ -255,8 +265,10 @@ func (l *Launcher) StartLocalAI() error {
255265
if err := l.localaiCmd.Process.Signal(syscall.Signal(0)); err != nil {
256266
// Process is dead, mark as not running
257267
l.isRunning = false
258-
l.updateRunningState(false)
259-
l.updateStatus("LocalAI failed to start properly")
268+
fyne.Do(func() {
269+
l.updateRunningState(false)
270+
l.updateStatus("LocalAI failed to start properly")
271+
})
260272
}
261273
}
262274
}
@@ -280,8 +292,10 @@ func (l *Launcher) StopLocalAI() error {
280292
}
281293

282294
l.isRunning = false
283-
l.updateRunningState(false)
284-
l.updateStatus("LocalAI stopped")
295+
fyne.Do(func() {
296+
l.updateRunningState(false)
297+
l.updateStatus("LocalAI stopped")
298+
})
285299
return nil
286300
}
287301

0 commit comments

Comments
 (0)