vlff李飞飞 commited on
Commit
2b56a6b
1 Parent(s): 253f22f
qwen_server/database_server.py CHANGED
@@ -50,7 +50,8 @@ def update_pop_url(data, cache_file_popup_url, access_token):
50
  new_line = {'url': data['url'], "access_token": access_token}
51
  lines = []
52
  for line in jsonlines.open(cache_file_popup_url):
53
- lines.append(line)
 
54
  lines.append(new_line)
55
  with jsonlines.open(cache_file_popup_url, mode='w') as writer:
56
  for new_line in lines:
@@ -64,7 +65,7 @@ def change_checkbox_state(text, cache_file, access_token):
64
  return {'result': 'no file'}
65
  lines = []
66
  for line in jsonlines.open(cache_file):
67
- if line['url'] == text[3:] and line['access_token'] == access_token:
68
  if line['checked']:
69
  line['checked'] = False
70
  else:
 
50
  new_line = {'url': data['url'], "access_token": access_token}
51
  lines = []
52
  for line in jsonlines.open(cache_file_popup_url):
53
+ if line['access_token'] == access_token and line['url'] != data['url']:
54
+ lines.append(line)
55
  lines.append(new_line)
56
  with jsonlines.open(cache_file_popup_url, mode='w') as writer:
57
  for new_line in lines:
 
65
  return {'result': 'no file'}
66
  lines = []
67
  for line in jsonlines.open(cache_file):
68
+ if line['access_token'] == access_token and line['url'] == text[3:]:
69
  if line['checked']:
70
  line['checked'] = False
71
  else:
qwen_server/utils.py CHANGED
@@ -129,7 +129,7 @@ def extract_and_cache_document(data, cache_file, cache_root, access_token):
129
  lines = []
130
  if os.path.exists(cache_file):
131
  for line in jsonlines.open(cache_file):
132
- if line['url'] != data['url']:
133
  lines.append(line)
134
  lines.append(new_record.to_dict()) # cache
135
  with jsonlines.open(cache_file, mode='w') as writer:
 
129
  lines = []
130
  if os.path.exists(cache_file):
131
  for line in jsonlines.open(cache_file):
132
+ if line['access_token'] == access_token and line['url'] != data['url']:
133
  lines.append(line)
134
  lines.append(new_record.to_dict()) # cache
135
  with jsonlines.open(cache_file, mode='w') as writer: