From b1a8345c7559c6240f5832847262a0ed25497480 Mon Sep 17 00:00:00 2001 From: Huan He <140455389+huanhe4096@users.noreply.github.com> Date: Fri, 8 Nov 2024 11:37:54 -0500 Subject: [PATCH] update ai --- web/src/App.vue | 4 ++- web/src/DataStore.js | 21 +++++++++++- web/src/components/AIHelper.vue | 43 ++++++++++++++++------- web/src/components/ItemDetail.vue | 57 +++++++++++++++++++++++-------- 4 files changed, 96 insertions(+), 29 deletions(-) diff --git a/web/src/App.vue b/web/src/App.vue index a8ddd26..2951497 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -57,7 +57,7 @@ const store = useDataStore(); - Novelty Reviewer + Waffle v0.1.0 | @@ -124,10 +124,12 @@ const store = useDataStore(); } .main-info { width: 50%; + /* max-width: 600px; */ overflow-y: hidden; } .review-panel { width: 50%; + max-width: 700px; overflow-y: hidden; } diff --git a/web/src/DataStore.js b/web/src/DataStore.js index ee5613e..d782f0d 100644 --- a/web/src/DataStore.js +++ b/web/src/DataStore.js @@ -94,6 +94,9 @@ state: () => ({ */ taxonomy: [], + // translation + translation: {}, + // prompt prompt_file: null, llm_prompt: null, @@ -102,7 +105,6 @@ state: () => ({ enable_highlight: true, is_fetching_metadata: false, is_translating: false, - is_asking_ai: false, is_saving_dataset_file: false, has_data_unsaved: false, @@ -217,6 +219,23 @@ actions: { return true; }, + hasWorkingItemTranslation: function(section) { + if (this.working_item_idx == -1) { + return false; + } + if (!this.translation.hasOwnProperty(this.working_item.pmid)) { + return false; + } + if (!this.translation[this.working_item.pmid].hasOwnProperty(section)) { + return false; + } + return true; + }, + + getWorkingItemTranslation: function(section) { + return this.translation[this.working_item.pmid][section]; + }, + formatTsvRow: function(row) { let attrs = [ // basic information diff --git a/web/src/components/AIHelper.vue b/web/src/components/AIHelper.vue index 02471c3..823d59c 100644 --- a/web/src/components/AIHelper.vue +++ b/web/src/components/AIHelper.vue @@ -23,14 +23,12 @@ async function onClickAccept(model, result) { } async function onClickReview(model) { - status.value[model] = 'reviewing'; - // set flag - store.flag.is_asking_ai = true; + status.value[model] = 'reviewing'; console.log(`* AI Helper [${model}] is thinking ...`); let d = await ai_helper.ask( - `I will provide a list of concepts, please randomly select one of them to echo for now: + `I will provide a list of concepts, please randomly select one of them to echo for now. Please exactly use what listed. Don't add any other words in the output. - New tool - New gene @@ -55,6 +53,16 @@ async function onClickReviewAll() { onClickReview(model.id); } } + +function isAllReviewed() { + for (let model of store.config.ai_models) { + if (isReviewing(model.id)) { + return false; + } + } + + return true; +}