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