-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a8579d
commit 424568d
Showing
17 changed files
with
286 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
DATABASE_URL=sqlite://db.sqlite3 | ||
OLLAMA_URL=http://host.docker.internal:11434 | ||
LOKAI_DEFAULT_LLM_MODEL=phi3:3.8b | ||
LOKAI_HOST=0.0.0.0 | ||
LOKAI_PORT=3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM rust:1.77-slim as builder | ||
RUN apt-get update \ | ||
&& apt-get install -y build-essential clang lld | ||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | ||
&& apt-get install -y nodejs npm \ | ||
&& npm install -g [email protected] | ||
WORKDIR /lokai | ||
COPY . . | ||
RUN cargo build --release | ||
|
||
FROM debian:bookworm-slim | ||
WORKDIR /lokai | ||
COPY --from=builder /lokai/target/release/lokai . | ||
COPY --from=builder /lokai/static/ ./static/ | ||
COPY ./templates/ ./templates/ | ||
COPY ./migrations/ ./migrations/ | ||
|
||
ENTRYPOINT [ "/lokai/lokai" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
DROP INDEX IF EXISTS idx_conversation_settings_conversation_id; | ||
DROP TABLE IF EXISTS conversation_settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CREATE TABLE IF NOT EXISTS conversation_settings ( | ||
id TEXT NOT NULL PRIMARY KEY, | ||
llm_model TEXT NOT NULL, | ||
conversation_id TEXT NOT NULL, | ||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL | ||
); | ||
CREATE INDEX idx_conversation_settings_conversation_id ON conversation_settings (conversation_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::env; | ||
|
||
use once_cell::sync::Lazy; | ||
|
||
fn get_env_var<'a, 'b>(env_var: &'a str, default: &'b str) -> String { | ||
env::var(env_var).unwrap_or(default.to_string()) | ||
} | ||
|
||
#[derive(Clone)] | ||
pub struct Config { | ||
pub database_url: String, | ||
pub ollama_url: String, | ||
pub lokai_default_llm_model: String, | ||
pub lokai_host: String, | ||
pub lokai_port: String, | ||
} | ||
|
||
impl Config { | ||
fn new() -> Self { | ||
Self { | ||
database_url: get_env_var("DATABASE_URL", "sqlite://db.sqlite3"), | ||
ollama_url: get_env_var("OLLAMA_URL", "http://host.docker.internal:11434"), | ||
lokai_default_llm_model: get_env_var("LOKAI_DEFAULT_LLM_MODEL", "phi3:3.8b"), | ||
lokai_host: get_env_var("LOKAI_HOST", "0.0.0.0"), | ||
lokai_port: get_env_var("LOKAI_PORT", "3000"), | ||
} | ||
} | ||
|
||
pub fn lokai_url(&self) -> String { | ||
format!("{}:{}", self.lokai_host, self.lokai_port) | ||
} | ||
} | ||
|
||
pub static CONFIG: Lazy<Config> = Lazy::new(|| Config::new()); |
Oops, something went wrong.