Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
7c2bb764
Commit
7c2bb764
authored
Jul 06, 2023
by
Eva Ho
Browse files
improve the first time installing experience
parent
9f528c12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
2 deletions
+37
-2
app/src/index.ts
app/src/index.ts
+37
-2
No files found.
app/src/index.ts
View file @
7c2bb764
...
@@ -25,7 +25,10 @@ const createSystemtray = () => {
...
@@ -25,7 +25,10 @@ const createSystemtray = () => {
})
})
}
}
const
contextMenu
=
Menu
.
buildFromTemplate
([{
label
:
'
Quit
'
,
type
:
'
normal
'
,
click
:
()
=>
app
.
quit
()
}])
const
contextMenu
=
Menu
.
buildFromTemplate
([
{
role
:
'
quit
'
,
label
:
'
Quit Ollama
'
,
accelerator
:
'
Command+Q
'
},
])
tray
.
setContextMenu
(
contextMenu
)
tray
.
setContextMenu
(
contextMenu
)
tray
.
setToolTip
(
'
Ollama
'
)
tray
.
setToolTip
(
'
Ollama
'
)
...
@@ -90,7 +93,7 @@ function installCLI() {
...
@@ -90,7 +93,7 @@ function installCLI() {
})
})
.
then
(
result
=>
{
.
then
(
result
=>
{
if
(
result
.
response
===
0
)
{
if
(
result
.
response
===
0
)
{
le
t
command
=
`
cons
t
command
=
`
do shell script "ln -F -s
${
ollama
}
/usr/local/bin/ollama" with administrator privileges
do shell script "ln -F -s
${
ollama
}
/usr/local/bin/ollama" with administrator privileges
`
`
exec
(
`osascript -e '
${
command
}
'`
,
(
error
:
Error
|
null
,
stdout
:
string
,
stderr
:
string
)
=>
{
exec
(
`osascript -e '
${
command
}
'`
,
(
error
:
Error
|
null
,
stdout
:
string
,
stderr
:
string
)
=>
{
...
@@ -109,8 +112,40 @@ function installCLI() {
...
@@ -109,8 +112,40 @@ function installCLI() {
// initialization and is ready to create browser windows.
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
// Some APIs can only be used after this event occurs.
app
.
on
(
'
ready
'
,
()
=>
{
app
.
on
(
'
ready
'
,
()
=>
{
if
(
process
.
platform
===
'
darwin
'
)
{
if
(
process
.
platform
===
'
darwin
'
)
{
app
.
dock
.
hide
()
app
.
dock
.
hide
()
if
(
!
app
.
isInApplicationsFolder
())
{
const
chosen
=
dialog
.
showMessageBoxSync
({
type
:
'
question
'
,
buttons
:
[
'
Move to Applications
'
,
'
Do Not Move
'
],
message
:
'
Move Ollama to the Applications directory?
'
,
defaultId
:
0
,
cancelId
:
1
})
if
(
chosen
===
0
)
{
try
{
app
.
moveToApplicationsFolder
({
conflictHandler
:
(
conflictType
)
=>
{
if
(
conflictType
===
'
existsAndRunning
'
)
{
dialog
.
showMessageBoxSync
({
type
:
'
info
'
,
message
:
'
Cannot move to Applications directory
'
,
detail
:
'
Another version of Ollama is currently running from your Applications directory. Close it first and try again.
'
})
}
return
true
}
})
return
}
catch
(
e
)
{
console
.
error
(
'
Failed to move to applications folder
'
)
console
.
error
(
e
)
}
}
}
}
}
createSystemtray
()
createSystemtray
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment