softnix-sdp-ai
v1.1.78
Published
## Installation
Downloads
1,679
Readme
softnix-sdp-ai
Installation
bun a softnix-sdp-ai
Usage
import { SoftnixSdpAi } from "softnix-sdp-ai"
type SoftnixSdpAiConfig = {
url: string
token: string
}
type SoftnixSdpAiSystemConfig = SoftnixSdpAiConfig & {
ollama_host: string
onConnect?: (ws: WsModel) => void
onMessage?: (ws: WsModel, ...e: OnMessage) => void
onClose?: (ws: WsModel, e: CloseEvent) => void
onError?: (ws: WsModel, e: Event) => void
onBeforeDelete?: (model: string) => boolean
}
const { SOFTNIX_HOST = "http://localhost:3000", token } = Bun.env
SoftnixSdpAiSystem({
url: SOFTNIX_HOST, token, ollama_host: "http://localhost:11434",
onConnect(ws) {
setInterval(() => {
ws.send({ action: "connection" })
}, 60 * 5 * 1_000)
}
})
For more detailed documentation, please refer to the Main README.
This project was created using bun init
in bun v1.1.30. Bun is a fast all-in-one JavaScript runtime.
Docker
Required environments
SOFTNIX_HOST # Softnix sdp-ai url
OLLAMA_HOST # Ollama base url
TOKEN # Token
Pull image
docker pull registry.gitlab.com/softnixdev/sdp-ai:client-latest-test
Run image
docker run -e SOFTNIX_HOST=[SOFTNIX_HOST] -e OLLAMA_HOST=[OLLAMA_HOST] -e TOKEN=[TOKEN] registry.gitlab.com/softnixdev/sdp-ai:client-latest-test
Docker compose
services:
app:
image: registry.gitlab.com/softnixdev/sdp-ai:client-latest-test
environment:
- SOFTNIX_HOST=[SOFTNIX_HOST]
- OLLAMA_HOST=[OLLAMA_HOST]
- TOKEN=[TOKEN]
docker compose up