-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set llm as optional feature
- Loading branch information
Showing
5 changed files
with
65 additions
and
59 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,23 +1,33 @@ | ||
use std::sync::Arc; | ||
use log::debug; | ||
use crate::query_engine::QueryEngine; | ||
use serde_json; | ||
|
||
pub fn get_server_info(engine_arc: Arc<QueryEngine>) -> String { | ||
serde_json::to_string( &engine_arc.server_info ).unwrap() | ||
use crate::query_engine::{QueryEngine, ServerInformation}; | ||
use axum::Json; | ||
use axum::extract::State; | ||
use axum::{response::Html, routing::get, Router, extract::Path}; | ||
|
||
pub async fn get_server_info(State(engine_arc): State<Arc<QueryEngine>>) | ||
-> Json<ServerInformation> { | ||
axum::Json( engine_arc.server_info.to_owned() ) | ||
} | ||
pub fn query(term: String, engine_arc: Arc<QueryEngine>) | ||
-> String { | ||
|
||
pub async fn query( | ||
Path(term) : Path<String>, | ||
State(engine_arc): State<Arc<QueryEngine>> | ||
) -> Html<String>{ | ||
|
||
debug!("Original Search term {}", term); | ||
engine_arc.query_pipeline(term) | ||
let r = engine_arc.query_pipeline(term); | ||
Html(r) | ||
} | ||
|
||
|
||
pub fn generate_word_cloud(engine_arc: Arc<QueryEngine>) -> String { | ||
pub async fn generate_word_cloud(State(engine_arc): State<Arc<QueryEngine>>) | ||
-> Html<String> { | ||
let div_id = "fireSeqSearchWordcloudRawJson"; | ||
let json = engine_arc.generate_wordcloud(); | ||
|
||
let div = format!("<div id=\"{}\">{}</div>", div_id, json); | ||
div | ||
Html(div) | ||
} | ||
|
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
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