web search done right
show some information about alice at the top of each conversation
Mikkel Denker18fe4a99e29b
diff --git a/core/src/entrypoint/configure.rs b/core/src/entrypoint/configure.rsindex 26e1ec12..7becea3c 100644--- a/core/src/entrypoint/configure.rs+++ b/core/src/entrypoint/configure.rs@@ -196,3 +196,40 @@ pub fn run(skip_download: bool) -> Result<()> {Ok(())}++pub fn alice() -> Result<()> {+ // create /data/alice folder+ let p = Path::new(DATA_PATH).join("alice");++ if !p.exists() {+ fs::create_dir_all(p)?;+ }++ tokio::runtime::Builder::new_current_thread()+ .enable_all()+ .build()+ .unwrap()+ .block_on(async {+ for name in ["model.safetensors", "tokenizer.json"] {+ info!("Downloading {}", name);+ let body = reqwest::get(format!(+ "http://s3.trystract.com/{BUCKET_NAME}/alice/{name}"+ ))+ .await+ .unwrap();++ let mut file = File::create(Path::new(DATA_PATH).join("alice").join(name))+ .await+ .unwrap();+ let mut bytes = body.bytes_stream();++ while let Some(item) = bytes.next().await {+ io::copy(&mut item.unwrap().as_ref(), &mut file)+ .await+ .unwrap();+ }+ }+ });++ Ok(())+}diff --git a/core/src/main.rs b/core/src/main.rsindex 76910025..8e77de82 100644--- a/core/src/main.rs+++ b/core/src/main.rs@@ -87,6 +87,8 @@ enum Commands {Configure {#[clap(long, takes_value = false)]skip_download: bool,++ alice: bool,},}@@ -278,7 +280,16 @@ fn main() -> Result<()> {autosuggest_scrape::run(queries_to_scrape, gl, ms_sleep_between_req, output_dir)?;}#[cfg(feature = "dev")]- Commands::Configure { skip_download } => configure::run(skip_download)?,+ Commands::Configure {+ skip_download,+ alice,+ } => {+ if alice && !skip_download {+ configure::alice()?;+ } else {+ configure::run(skip_download)?;+ }+ }Commands::CrawlStability {output_path,host_rank_paths,diff --git a/frontend/src/pages/chat.astro b/frontend/src/pages/chat.astroindex 3bac841f..32bb1a4b 100644--- a/frontend/src/pages/chat.astro+++ b/frontend/src/pages/chat.astro@@ -16,6 +16,10 @@ import OpticSelector from "../components/OpticSelector.astro";<div class="flex flex-col row-start-2 mt-10 px-2 items-center"><div class="max-w-3xl w-full gap-y-5 flex flex-col h-full"><div id="message-container" class="flex px-5 flex-col gap-y-3 h-full">+ <div class="flex flex-col h-full items-center gap-y-3">+ <h1 class="text-2xl font-bold">Chat with Alice</h1>+ <p class="text-sm">Alice is an AI that tries to answer your questions by searhing for information on the internet. Alice is <b class="font-bold">highly experimental</b> and might produce wrong answers. As always, you should verify the information from multiple sources and make sure the sources supports the claims.</p>+ </div></div><div class="w-full gap-y-2"><div class="flex w-full border rounded-xl p-2 pl-3">