From 098e34edcec37cbc5244eb3763ba0d9cdfd4c1e7 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Wed, 23 Mar 2022 00:54:46 +0800 Subject: [PATCH] fix: attention --- src/Flows.js | 12 ++++-------- src/infrastructure/functions.js | 9 +++++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Flows.js b/src/Flows.js index e0c5aba..4e654fb 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -895,8 +895,7 @@ class FlowItemRow extends PureComponent { hidden: window.config.block_words_v2.some((word) => props.info.text.includes(word), ) && !props.info.can_del || this.needFold, - attention: - props.attention_override === null ? false : props.attention_override, + attention: props.info.attention, cached: true, // default no display anything }; } @@ -1258,9 +1257,6 @@ function FlowChunk(props) { mode={props.mode} show_sidebar={props.show_sidebar} token={token} - attention_override={ - props.mode === 'attention_finished' ? true : null - } deletion_detect={props.deletion_detect} search_param={props.search_param} /> @@ -1357,11 +1353,10 @@ class SubFlow extends PureComponent { load_page(page) { const failed = (err) => { console.error(err); - console.log(err.to_string); this.setState((prev, props) => ({ loaded_pages: prev.loaded_pages - 1, loading_status: 'failed', - error_msg: prev.loaded_pages > 1 ? '找不到更多了' : '' + err, + error_msg: '' + err, })); }; @@ -1526,7 +1521,8 @@ class SubFlow extends PureComponent { }, loading_status: 'done', })); - }); + }) + .catch(failed); } else { console.log('local attention finished'); this.setState({ diff --git a/src/infrastructure/functions.js b/src/infrastructure/functions.js index 20e26a2..c7b20e5 100644 --- a/src/infrastructure/functions.js +++ b/src/infrastructure/functions.js @@ -1,7 +1,12 @@ export function get_json(res) { if(!res.ok) { - console.log('error:', res); - throw Error(`${res.status} ${res.statusText}`); + return ( + res.text().then((t) => { + console.log('error:', res); + t = t.length < 100 ? t : ''; + throw Error(`${res.status} ${res.statusText} ${t}`); + }) + ); } return ( res