about summary refs log tree commit diff stats
path: root/html/matt-chat
diff options
context:
space:
mode:
Diffstat (limited to 'html/matt-chat')
-rw-r--r--html/matt-chat/example.plist16
-rwxr-xr-xhtml/matt-chat/server.sh23
2 files changed, 39 insertions, 0 deletions
diff --git a/html/matt-chat/example.plist b/html/matt-chat/example.plist
new file mode 100644
index 0000000..c3bbfca
--- /dev/null
+++ b/html/matt-chat/example.plist
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+    <key>Label</key>
+    <string>com.user.server</string>
+    <key>ProgramArguments</key>
+    <array>
+        <string>/Users/eli/Code/tour/html/matt-chat/server.sh</string>
+    </array>
+    <key>RunAtLoad</key>
+    <true/>
+    <key>KeepAlive</key>
+    <true/>
+</dict>
+</plist>
\ No newline at end of file
diff --git a/html/matt-chat/server.sh b/html/matt-chat/server.sh
new file mode 100755
index 0000000..80a44f2
--- /dev/null
+++ b/html/matt-chat/server.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# check that the ollama server is running, if it isn't, start it
+if ! pgrep -f ollama; then
+    echo "Ollama server is not running. Starting it now..."
+    ollama start
+fi
+
+# check that port 38478 is free
+if lsof -i :38478; then
+    echo "Port 38478 is already in use. Please choose a different port."
+    exit 1
+fi
+
+# Start a simple HTTP server using Python on port 38478
+python3 -m http.server 38478
+
+
+#   nvim ~/Library/LaunchAgents/com.user.server.plist
+#   launchctl load ~/Library/LaunchAgents/com.user.server.plist
+#   launchctl start com.user.server
+#   launchctl list | grep com.user.server
+#   launchctl unload ~/Library/LaunchAgents/com.user.server.plist