Skip to content

Commit

Permalink
clean log
Browse files Browse the repository at this point in the history
  • Loading branch information
Endle committed Sep 7, 2024
1 parent 8fccfda commit 564cda5
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions fireSeqSearch_addon/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,8 @@ async function processLlmSummary(serverInfo, parsedSearchResult, fireDom) {

const doneListApi = "http://127.0.0.1:3030/llm_done_list";
let list = await fetch(doneListApi);
console.log(list);
list = await list.text();
list = JSON.parse(list);
console.log(list);

const findByTitle = function(title) {
const ul = fireDom.querySelector( ".fireSeqSearchHitList" );
Expand All @@ -163,14 +161,11 @@ async function processLlmSummary(serverInfo, parsedSearchResult, fireDom) {
return null;
};
const setLlmResult = function (title, llmSummary) {
console.log("handle");
console.log(title);
const targetRow = findByTitle(title);
if (targetRow === null) {
consoleLogForDebug("Error! Can't find dom for ", title);
return;
}
console.log(targetRow);
if (targetRow.querySelector( ".fireSeqSearchLlmSummary" ) != null) {
consoleLogDebug("Skip. We have the summary for ", title);
return;
Expand All @@ -184,7 +179,7 @@ async function processLlmSummary(serverInfo, parsedSearchResult, fireDom) {
for (const record of parsedSearchResult) {
const title = record.title;
if (!list.includes(title)) {
console.log("Not ready, skip" + title);
consoleLogForDebug("Not ready, skip" + title);
continue;
}
// TODO remove hard code port
Expand Down Expand Up @@ -241,8 +236,6 @@ function createFireSeqDom(serverInfo, parsedSearchResult) {
btn.onclick = function () {
setSummaryState(".fireSeqSearchHitSummary", false);
setSummaryState(".fireSeqSearchLlmSummary", true);
console.log("llm clicked");
console.log(div);
processLlmSummary(serverInfo, parsedSearchResult, div);
};
titleBar.appendChild(btn);
Expand Down Expand Up @@ -315,10 +308,6 @@ async function mainProcess(fetchResultArray) {
consoleLogForDebug(serverInfo);
const parsedSearchResult = parseRawList(rawSearchResult);

console.log("in main");
console.log(rawSearchResult);
console.log(parsedSearchResult);

const fireDom = createFireSeqDom(serverInfo, parsedSearchResult);

appendResultToSearchResult(serverInfo, parsedSearchResult, fireDom);
Expand Down Expand Up @@ -359,13 +348,11 @@ function getSearchParameterFromCurrentPage() {

addGlobalStyle(fireSeqSearchScriptCSS);

console.log("main to invoke");
//https://gomakethings.com/waiting-for-multiple-all-api-responses-to-complete-with-the-vanilla-js-promise.all-method/
Promise.all([
fetch("http://127.0.0.1:3030/server_info"),
fetch("http://127.0.0.1:3030/query/" + searchParameter)
]).then(function (responses) {
console.log("main to invoke");
return Promise.all(responses.map(function (response) {return response.json();}));
}).then(function (data) {
mainProcess(data);
Expand Down

0 comments on commit 564cda5

Please sign in to comment.