Compare commits
2 commits
bebdd35c6e
...
5b12762511
Author | SHA1 | Date | |
---|---|---|---|
5b12762511 | |||
19898b5d02 |
18 changed files with 147 additions and 90 deletions
13
.dist/lwatch.fish
Executable file
13
.dist/lwatch.fish
Executable file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
set DIRECTORY_TO_WATCH "./"
|
||||||
|
set SCRIPT_TO_RUN "leptosfmt ./ && rustywind --write ./"
|
||||||
|
|
||||||
|
while true
|
||||||
|
# Wait for any change in the directory
|
||||||
|
inotifywait -e modify,create,delete,move $DIRECTORY_TO_WATCH
|
||||||
|
|
||||||
|
# Run your script
|
||||||
|
bash -c "$SCRIPT_TO_RUN"
|
||||||
|
sleep 5
|
||||||
|
end
|
|
@ -9,6 +9,9 @@ jobs:
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Forgejo!"
|
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Forgejo!"
|
||||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||||
|
- run: echo PATH: $PATH
|
||||||
|
- run: ls $PATH
|
||||||
|
- run: echo =====================================================
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4
|
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4
|
||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
96
Makefile.toml
Normal file
96
Makefile.toml
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
[config]
|
||||||
|
load_cargo_aliases = false
|
||||||
|
|
||||||
|
[env]
|
||||||
|
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
|
||||||
|
# leptos repos
|
||||||
|
LEPTOS_REPOS = "llama_forge_rs"
|
||||||
|
#
|
||||||
|
# DB_REPOS
|
||||||
|
|
||||||
|
[tasks.default]
|
||||||
|
alias = "all"
|
||||||
|
|
||||||
|
[tasks.test123]
|
||||||
|
script = "echo test123-${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}"
|
||||||
|
|
||||||
|
[tasks.refresh-all]
|
||||||
|
description = "clean the repo and rebuild everything"
|
||||||
|
dependencies = ["clean", "all", "lall"]
|
||||||
|
|
||||||
|
[tasks.mksitedir]
|
||||||
|
workspace = false
|
||||||
|
script = "mkdir -p ./target/site"
|
||||||
|
|
||||||
|
[tasks.all]
|
||||||
|
description = "rebuild everything"
|
||||||
|
dependencies = ["mksitedir", "docset", "check", "clippy", "build", "build-release", "format", "lformat", "lbuild", "lbuild-release"]
|
||||||
|
|
||||||
|
[tasks.lformat]
|
||||||
|
scripts = "leptosfmt . && rustywind . --write"
|
||||||
|
|
||||||
|
[tasks.lbuild]
|
||||||
|
category = "Build"
|
||||||
|
script = '''
|
||||||
|
#!/usr/bin/env fish
|
||||||
|
set current "$CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER"
|
||||||
|
if contains "$LEPTOS_REPOS" $current
|
||||||
|
cargo leptos build
|
||||||
|
else
|
||||||
|
$current is not a leptos repo!
|
||||||
|
end
|
||||||
|
'''
|
||||||
|
|
||||||
|
[tasks.lbuild-release]
|
||||||
|
category = "Build"
|
||||||
|
command = "cargo"
|
||||||
|
args = ["leptos", "build", "--release"]
|
||||||
|
|
||||||
|
[tasks.lserve]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["leptos", "serve"]
|
||||||
|
|
||||||
|
[tasks.lwatch]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["leptos", "watch", "--hot-reload"]
|
||||||
|
|
||||||
|
[tasks.docset]
|
||||||
|
workspace = false
|
||||||
|
dependencies = ["make-docset", "cp-docset"]
|
||||||
|
|
||||||
|
[tasks.make-docset]
|
||||||
|
workspace = false
|
||||||
|
script = "cargo docset --workspace --platform-family redvault-ai "
|
||||||
|
|
||||||
|
[tasks.cp-docset]
|
||||||
|
workspace = false
|
||||||
|
script = "cp -r target/docset/redvault-ai.docset ~/.local/share/Zeal/Zeal/docsets/"
|
||||||
|
|
||||||
|
[tasks.watch-test]
|
||||||
|
command = "cargo"
|
||||||
|
args = [
|
||||||
|
"watch",
|
||||||
|
"--",
|
||||||
|
"cargo",
|
||||||
|
"ltest",
|
||||||
|
"--target-dir",
|
||||||
|
"target/test",
|
||||||
|
"--all-features",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tasks.watch-check]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["watch", "--", "cargo", "lcheck", "--all-features"]
|
||||||
|
|
||||||
|
[tasks.lwatch-fmt]
|
||||||
|
command = "fish"
|
||||||
|
args = ["./.dist/watch.fish"]
|
||||||
|
|
||||||
|
[tasks.reset-db]
|
||||||
|
# env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = ["vewa_xls_export"] }
|
||||||
|
script = '''
|
||||||
|
DB_FILE=${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}.sqlite3
|
||||||
|
rm ../$DB_FILE \
|
||||||
|
&& touch ../$DB_FILE \
|
||||||
|
&& cargo sqlx migrate run --database-url="sqlite:../$DB_FILE"
|
||||||
|
'''
|
|
@ -1,15 +0,0 @@
|
||||||
#!/usr/bin/env fish
|
|
||||||
|
|
||||||
echo "watchPWD: $(pwd)"
|
|
||||||
|
|
||||||
set DIRECTORY_TO_WATCH "./src"
|
|
||||||
set SCRIPT_TO_RUN "echo a && leptosfmt $(pwd) && rustywind --write ./src && echo b"
|
|
||||||
|
|
||||||
while true
|
|
||||||
# Wait for any change in the directory
|
|
||||||
inotifywait -r -e modify,create,delete,move $DIRECTORY_TO_WATCH
|
|
||||||
|
|
||||||
# Run your script
|
|
||||||
bash -c "$SCRIPT_TO_RUN"
|
|
||||||
sleep 5
|
|
||||||
end
|
|
|
@ -1,34 +0,0 @@
|
||||||
{
|
|
||||||
fetchFromGitHub,
|
|
||||||
lib,
|
|
||||||
pkg-config,
|
|
||||||
rustPlatform,
|
|
||||||
stdenv,
|
|
||||||
}: let
|
|
||||||
inherit (lib) optionals;
|
|
||||||
in
|
|
||||||
rustPlatform.buildRustPackage rec {
|
|
||||||
pname = "cargo-leptos";
|
|
||||||
version = "0.2.16";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "leptos-rs";
|
|
||||||
repo = pname;
|
|
||||||
rev = "v0.2.16";
|
|
||||||
hash = "sha256-yDBVo3GarKvcuMX7mxdxx0SJSJ5VOX3bUx6XmYxLfq4=";
|
|
||||||
};
|
|
||||||
|
|
||||||
cargoHash = "sha256-DZbZ3SHGWvje0gEqlx2mdLvCR4U3Xzkp8gS9FIbxW6g=";
|
|
||||||
|
|
||||||
# https://github.com/leptos-rs/cargo-leptos#dependencies
|
|
||||||
buildFeatures = ["no_downloads"]; # cargo-leptos will try to install missing dependencies on its own otherwise
|
|
||||||
doCheck = false; # Check phase tries to query crates.io
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "A build tool for the Leptos web framework";
|
|
||||||
homepage = "https://github.com/leptos-rs/cargo-leptos";
|
|
||||||
changelog = "https://github.com/leptos-rs/cargo-leptos/releases/tag/${version}";
|
|
||||||
license = with licenses; [mit];
|
|
||||||
maintainers = with maintainers; [benwis];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -27,22 +27,22 @@ pub fn App() -> impl IntoView {
|
||||||
provide_context(Arc::new(span));
|
provide_context(Arc::new(span));
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<Stylesheet id="leptos" href="/pkg/llama_forge_rs.css"/>
|
<Stylesheet id="leptos" href="/pkg/llama_forge_rs.css" />
|
||||||
|
|
||||||
// sets the document title
|
// sets the document title
|
||||||
<Title text="LLama Forge RS"/>
|
<Title text="LLama Forge RS" />
|
||||||
|
|
||||||
<Router fallback=|| {
|
<Router fallback=|| {
|
||||||
let mut outside_errors = Errors::default();
|
let mut outside_errors = Errors::default();
|
||||||
outside_errors.insert_with_default_key(AppError::NotFound);
|
outside_errors.insert_with_default_key(AppError::NotFound);
|
||||||
view! { <ErrorTemplate outside_errors/> }.into_view()
|
view! { <ErrorTemplate outside_errors /> }.into_view()
|
||||||
}>
|
}>
|
||||||
<main>
|
<main>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="" view=MainPage>
|
<Route path="" view=MainPage>
|
||||||
<Route path="/chat" view=ChatPage/>
|
<Route path="/chat" view=ChatPage />
|
||||||
// TODO make settings page for proxy-man
|
// TODO make settings page for proxy-man
|
||||||
// <SettingsRoutes/>
|
// <SettingsRoutes/>
|
||||||
</Route>
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -49,14 +49,9 @@ fn ChatMessageBubble(
|
||||||
|
|
||||||
let inner_p = move || {
|
let inner_p = move || {
|
||||||
if edit_mode.get() {
|
if edit_mode.get() {
|
||||||
view! {
|
view! { <p inner_html=move || { msg_str() }></p> }
|
||||||
|
|
||||||
<p inner_html=move || { msg_str() }></p>
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
view! {
|
view! { <p inner_html=move || { md_str() }></p> }
|
||||||
<p inner_html=move || { md_str() }></p>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,7 +91,7 @@ fn ChatMessageBubble(
|
||||||
on:click=exit_edit_mode
|
on:click=exit_edit_mode
|
||||||
class="absolute top-2 right-2 btn btn-xs btn-ghost btn-circle"
|
class="absolute top-2 right-2 btn btn-xs btn-ghost btn-circle"
|
||||||
>
|
>
|
||||||
<CheckmarkSvg/>
|
<CheckmarkSvg />
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
.into_view()
|
.into_view()
|
||||||
|
@ -106,7 +101,7 @@ fn ChatMessageBubble(
|
||||||
on:click=enter_edit_mode
|
on:click=enter_edit_mode
|
||||||
class="absolute top-2 right-2 btn btn-xs btn-ghost btn-circle"
|
class="absolute top-2 right-2 btn btn-xs btn-ghost btn-circle"
|
||||||
>
|
>
|
||||||
<PencilSvg/>
|
<PencilSvg />
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
.into_view()
|
.into_view()
|
||||||
|
@ -120,7 +115,7 @@ fn ChatMessageBubble(
|
||||||
on:click=move |_e| trash_message()
|
on:click=move |_e| trash_message()
|
||||||
class="absolute right-2 bottom-2 btn btn-xs btn-ghost btn-circle"
|
class="absolute right-2 bottom-2 btn btn-xs btn-ghost btn-circle"
|
||||||
>
|
>
|
||||||
<TrashSvg/>
|
<TrashSvg />
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
.into_view()
|
.into_view()
|
||||||
|
@ -182,7 +177,7 @@ pub fn ChatHistory(
|
||||||
}
|
}
|
||||||
|
|
||||||
children=move |msg| {
|
children=move |msg| {
|
||||||
view! { <ChatMessageBubble msg history/> }
|
view! { <ChatMessageBubble msg history /> }
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -306,7 +301,7 @@ fn ChatPrompt(
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
||||||
<SendSvg/>
|
<SendSvg />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
on:click=refresh_last_message
|
on:click=refresh_last_message
|
||||||
|
@ -317,7 +312,7 @@ fn ChatPrompt(
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
||||||
<RefreshSvg/>
|
<RefreshSvg />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -337,8 +332,8 @@ pub fn ChatPage() -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<Card>
|
<Card>
|
||||||
<div class="flex flex-col justify-between h-full">
|
<div class="flex flex-col justify-between h-full">
|
||||||
<ChatHistory receiving_response history response/>
|
<ChatHistory receiving_response history response />
|
||||||
<ChatPrompt receiving_response history response/>
|
<ChatPrompt receiving_response history response />
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ fn Navbar() -> impl IntoView {
|
||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<div tabindex="0" role="button" class="btn btn-ghost btn-circle">
|
<div tabindex="0" role="button" class="btn btn-ghost btn-circle">
|
||||||
<HamburgerSvg/>
|
<HamburgerSvg />
|
||||||
</div>
|
</div>
|
||||||
<ul
|
<ul
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
|
@ -32,7 +32,7 @@ fn Navbar() -> impl IntoView {
|
||||||
|
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
<button class="btn btn-ghost btn-circle">
|
<button class="btn btn-ghost btn-circle">
|
||||||
<img class="w-12 h-12" src="/logo.svg"/>
|
<img class="w-12 h-12" src="/logo.svg" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,7 +54,7 @@ fn Footer() -> impl IntoView {
|
||||||
pub fn Main(children: Children) -> impl IntoView {
|
pub fn Main(children: Children) -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<div class="flex flex-col w-screen h-screen">
|
<div class="flex flex-col w-screen h-screen">
|
||||||
<Navbar/>
|
<Navbar />
|
||||||
<div class="grid place-items-center p-4 grow">{children()}</div>
|
<div class="grid place-items-center p-4 grow">{children()}</div>
|
||||||
// <Footer/>
|
// <Footer/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -65,7 +65,7 @@ pub fn Main(children: Children) -> impl IntoView {
|
||||||
pub fn MainPage() -> impl IntoView {
|
pub fn MainPage() -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<Main>
|
<Main>
|
||||||
<Outlet/>
|
<Outlet />
|
||||||
</Main>
|
</Main>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ pub fn SettingsForm() -> impl IntoView {
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<div class="w-full form-control">
|
<div class="w-full form-control">
|
||||||
<button class="btn btn-primary" type="submit">
|
<button class="btn btn-primary" type="submit">
|
||||||
<SaveSvg/>
|
<SaveSvg />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ActionForm>
|
</ActionForm>
|
||||||
|
|
|
@ -33,10 +33,10 @@ fn BackendSettingsPage() -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<div class="flex justify-around">
|
<div class="flex justify-around">
|
||||||
<div class="flex flex-col p-4 w-1/3">
|
<div class="flex flex-col p-4 w-1/3">
|
||||||
<ProcessForm/>
|
<ProcessForm />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col p-4 w-2/3">
|
<div class="flex flex-col p-4 w-2/3">
|
||||||
<SettingsForm/>
|
<SettingsForm />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@ -67,18 +67,18 @@ fn SettingsPage() -> impl IntoView {
|
||||||
role="tablist"
|
role="tablist"
|
||||||
class="shadow-xl border-b-2 border-base-200 bg-base-300 rounded-none !rounded-t-lg shrink tabs tabs-boxed"
|
class="shadow-xl border-b-2 border-base-200 bg-base-300 rounded-none !rounded-t-lg shrink tabs tabs-boxed"
|
||||||
>
|
>
|
||||||
<TabButton path="/settings/backend" label="Backend"/>
|
<TabButton path="/settings/backend" label="Backend" />
|
||||||
<TabButton path="/settings/model" label="Model"/>
|
<TabButton path="/settings/model" label="Model" />
|
||||||
</div>
|
</div>
|
||||||
<div class="shadow-xl border-b-2 border-base-200 bg-base-300 rounded-none !rounded-t-lg shrink tabs tabs-boxed">
|
<div class="shadow-xl border-b-2 border-base-200 bg-base-300 rounded-none !rounded-t-lg shrink tabs tabs-boxed">
|
||||||
<button class="btn btn-sm" on:click=increment_gen>
|
<button class="btn btn-sm" on:click=increment_gen>
|
||||||
<RefreshSvg/>
|
<RefreshSvg />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grow">
|
<div class="grow">
|
||||||
<TabCard>
|
<TabCard>
|
||||||
<Outlet/>
|
<Outlet />
|
||||||
</TabCard>
|
</TabCard>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -89,8 +89,8 @@ fn SettingsPage() -> impl IntoView {
|
||||||
pub fn SettingsRoutes() -> impl IntoView {
|
pub fn SettingsRoutes() -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<Route path="/settings" view=SettingsPage>
|
<Route path="/settings" view=SettingsPage>
|
||||||
<Route path="/backend" view=BackendSettingsPage/>
|
<Route path="/backend" view=BackendSettingsPage />
|
||||||
<Route path="/model" view=ModelSettingsPage/>
|
<Route path="/model" view=ModelSettingsPage />
|
||||||
</Route>
|
</Route>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ pub async fn file_and_error_handler(
|
||||||
move || {
|
move || {
|
||||||
provide_context(app_state.pool.clone());
|
provide_context(app_state.pool.clone());
|
||||||
},
|
},
|
||||||
move || view! { <App/> },
|
move || view! { <App /> },
|
||||||
);
|
);
|
||||||
handler(req).await.into_response()
|
handler(req).await.into_response()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
hardware:
|
system_resources:
|
||||||
ram: 48G
|
ram: 48G
|
||||||
vram: 30G
|
vram: 30G
|
||||||
models:
|
model_specs:
|
||||||
- name: "tabby-code"
|
- name: "tabby-code"
|
||||||
port: 18080
|
port: 18080
|
||||||
# internal_port: 28080 # Optional
|
# internal_port: 28080 # Optional
|
||||||
|
|
|
@ -22,7 +22,7 @@ impl AppConfig {
|
||||||
if model.internal_port.is_none() {
|
if model.internal_port.is_none() {
|
||||||
model.internal_port = Some(
|
model.internal_port = Some(
|
||||||
openport::pick_random_unused_port()
|
openport::pick_random_unused_port()
|
||||||
.expect(&format!("No open port found for {:?}", model)),
|
.unwrap_or_else(|| panic!("No open port found for {:?}", model)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
|
use anyhow::Error as AnyError;
|
||||||
use axum::{http, response::IntoResponse};
|
use axum::{http, response::IntoResponse};
|
||||||
use hyper;
|
use hyper;
|
||||||
use reqwest;
|
use reqwest;
|
||||||
use reqwest_middleware;
|
use reqwest_middleware;
|
||||||
use std::io;
|
use std::io;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use anyhow::Error as AnyError;
|
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
#[derive(Error, Debug)]
|
||||||
pub enum AppError {
|
pub enum AppError {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use llama_proxy_man::{config::AppConfig, logging, start_server};
|
use llama_proxy_man::{config::AppConfig, logging, start_server};
|
||||||
use tokio;
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ pub fn parse_size(size_str: &str) -> Option<u64> {
|
||||||
let mut unit = String::new();
|
let mut unit = String::new();
|
||||||
|
|
||||||
for c in size_str.chars() {
|
for c in size_str.chars() {
|
||||||
if c.is_digit(10) || c == '.' {
|
if c.is_ascii_digit() || c == '.' {
|
||||||
num.push(c);
|
num.push(c);
|
||||||
} else {
|
} else {
|
||||||
unit.push(c);
|
unit.push(c);
|
||||||
|
|
Loading…
Add table
Reference in a new issue