Skip to content

Commit

Permalink
scripts (#61)
Browse files Browse the repository at this point in the history
* add chat streaming changes

* chore: infra:up|down

---------

Co-authored-by: Jignesh Solanki <[email protected]>
  • Loading branch information
tiero and jigneshsolanki authored Jun 2, 2023
1 parent e053e0d commit 7d685eb
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
"build": "tsc && vite build",
"dev": "vite",
"preview": "vite preview",
"tauri": "tauri"
"tauri": "tauri",
"infra:up": "bash ./scripts/up.sh",
"infra:down": "bash ./scripts/down.sh"
},
"type": "module",
"version": "0.0.8"
Expand Down
13 changes: 13 additions & 0 deletions scripts/down.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

container_name="premd"

# Check if container exists
if [ "$(docker ps -aq -f name=$container_name)" ]; then
# Stop and remove the container
echo "Stopping and removing existing container..."
docker stop $container_name
docker rm $container_name
else
echo "Container $container_name does not exist."
fi
32 changes: 32 additions & 0 deletions scripts/up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

image="ghcr.io/premai-io/premd:v0.0.8" # replace this with your image name
container_name="premd"

# Check if container exists
if [ "$(docker ps -q -f name=$container_name)" ]; then
# If it exists and it's running, stop it
if [ "$(docker ps -q -f status=running -f name=$container_name)" ]; then
echo "Stopping existing container..."
docker stop $container_name
fi
# Remove existing container
echo "Removing existing container..."
docker rm $container_name
fi

/usr/local/bin/docker run -d \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 54321:8000 \
--name $container_name \
-e PREM_REGISTRY_URL=https://raw.githubusercontent.com/premAI-io/prem-daemon/main/resources/mocks/manifests.json \
--rm \
$image

if [ $? -eq 0 ]
then
echo "Docker run command executed successfully"
else
echo "Failed to execute docker run" >&2
exit 1
fi
1 change: 0 additions & 1 deletion src/shared/hooks/usePremChatStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import useService from "./useService";
import { toast } from "react-toastify";
import { getBackendUrlFromStore } from "shared/store/setting";


const usePremChatStream = (
serviceId: string,
chatId: string | null
Expand Down

0 comments on commit 7d685eb

Please sign in to comment.