MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / main

Function main

scripts/add_must_read.py:299–349  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

297
298def main():
299 user_id = "user_001"
300 user_input = sys.argv[1] if len(sys.argv) > 1 else ""
301
302 if not user_input:
303 print("用法:python add_must_read.py \"加个必读作者:XXX\"")
304 print("示例:")
305 print(' python add_must_read.py "加个必读作者:Mohammed AlQuraishi"')
306 print(' python add_must_read.py "加个机构:Shanghai AI Lab"')
307 print(' python add_must_read.py "加个关键词:phase transition"')
308 print(' python add_must_read.py "查看必读清单"')
309 print(' python add_must_read.py "降低 Multimodal 权重到 0.5"')
310 return
311
312 profile = get_profile(user_id)
313 if not profile:
314 print(f"[错误] 未找到用户画像:{user_id}")
315 return
316
317 result = parse_input(user_input)
318 if not result:
319 print("[错误] 未识别操作类型")
320 print("请使用以下格式:")
321 print(' "加个必读作者:XXX"')
322 print(' "加个机构:XXX"')
323 print(' "加个关键词:XXX"')
324 print(' "删除必读作者:XXX"')
325 print(' "查看必读清单"')
326 print(' "降低 XXX 权重到 0.5"')
327 return
328
329 op, entity_type, entities = result
330
331 if op == 'add':
332 success, msg, updated = add_must_read(profile, entity_type, entities)
333 elif op == 'remove':
334 success, msg, updated = remove_must_read(profile, entity_type, entities)
335 elif op == 'list':
336 msg = list_must_read(profile)
337 updated = None
338 elif op == 'update_weight':
339 success, msg, updated = update_weight(profile, entity_type, entities)
340 else:
341 msg = "[错误] 未知操作"
342 updated = None
343
344 print(msg)
345
346 if updated:
347 update_profile(user_id, updated)
348 print(f"\n[已更新] 画像版本:{updated['version']}")
349
350
351if __name__ == "__main__":
352 main()

Callers 1

add_must_read.pyFile · 0.70

Calls 7

get_profileFunction · 0.90
update_profileFunction · 0.90
parse_inputFunction · 0.85
update_weightFunction · 0.85
add_must_readFunction · 0.70
remove_must_readFunction · 0.70
list_must_readFunction · 0.70

Tested by

no test coverage detected