Skip to content

Commit

Permalink
minor adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangpengHao committed Jan 17, 2025
1 parent 50fb1ec commit 7670ab3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use datafusion::{
physical_plan::ExecutionPlan,
prelude::{SessionConfig, SessionContext},
};
use parquet_reader::{ParquetReader, INMEMORY_STORE};
use leptos_router::{
components::Router,
hooks::{query_signal, use_query_map},
};
use parquet_reader::{ParquetReader, INMEMORY_STORE};

use query_results::{export_to_csv_inner, export_to_parquet_inner, QueryResult, QueryResultView};
use schema::SchemaSection;
Expand Down Expand Up @@ -410,7 +410,7 @@ fn App() -> impl IntoView {
"Tips:" <ul class="list-disc ml-6 mt-2 space-y-1">
<li>"Make sure the URL has CORS enabled."</li>
<li>
"If query with natural language, make sure to set the Anthropic API key."
"If query with natural language, make sure to set the Claude API key."
</li>
<li>
"I usually download the file and use the file picker above."
Expand Down
2 changes: 1 addition & 1 deletion src/object_store_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl ObjectStore for ObjectStoreCache {
let mut cache = self.cache.lock().await;
let bytes = match cache.entry(key) {
Entry::Occupied(o) => {
log!("hit cache");
log!("hit memory cache, range: {:?}", o.key().1);
o.get().clone()
}
Entry::Vacant(v) => {
Expand Down
17 changes: 5 additions & 12 deletions src/parquet_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,6 @@ fn S3Reader(
set_error_message: WriteSignal<Option<String>>,
set_parquet_table: WriteSignal<Option<ParquetTable>>,
) -> impl IntoView {
let (s3_endpoint, _) = signal(get_stored_value(
S3_ENDPOINT_KEY,
"https://s3.amazonaws.com",
));
let (s3_access_key_id, _) = signal(get_stored_value(S3_ACCESS_KEY_ID_KEY, ""));
let (s3_secret_key, _) = signal(get_stored_value(S3_SECRET_KEY_KEY, ""));
let (s3_bucket, set_s3_bucket) = signal(get_stored_value(S3_BUCKET_KEY, ""));
let (s3_region, set_s3_region) = signal(get_stored_value(S3_REGION_KEY, "us-east-1"));
let (s3_file_path, set_s3_file_path) = signal(get_stored_value(S3_FILE_PATH_KEY, ""));
Expand All @@ -372,9 +366,10 @@ fn S3Reader(
let on_s3_submit = move || {
set_error_message.set(None);

let endpoint = s3_endpoint.get();
let access_key_id = s3_access_key_id.get();
let secret_key = s3_secret_key.get();
let endpoint = get_stored_value(S3_ENDPOINT_KEY, "https://s3.amazonaws.com");
let access_key_id = get_stored_value(S3_ACCESS_KEY_ID_KEY, "");
let secret_key = get_stored_value(S3_SECRET_KEY_KEY, "");

let bucket = s3_bucket.get();
let region = s3_region.get();

Expand Down Expand Up @@ -412,9 +407,7 @@ fn S3Reader(
let metadata = reader.get_metadata().await.unwrap();
let object_store_url = ObjectStoreUrl::parse(&path).unwrap();
let ctx = SESSION_CTX.as_ref();
if ctx.runtime_env().object_store(&object_store_url).is_err() {
ctx.register_object_store(object_store_url.as_ref(), object_store);
}
ctx.register_object_store(object_store_url.as_ref(), object_store);

ctx.register_parquet(
&file_name,
Expand Down
2 changes: 1 addition & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub fn Settings(show: ReadSignal<bool>, set_show: WriteSignal<bool>) -> impl Int
<h3 class="text-lg font-medium mb-4">"LLM Configuration"</h3>
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-1">
"Anthropic API Key"
"Claude API Key" <a href="https://console.anthropic.com/account/keys" target="_blank" class="text-blue-500 hover:text-blue-700 ml-1">"(get key)"</a>
</label>
<input
type="password"
Expand Down

0 comments on commit 7670ab3

Please sign in to comment.