vansin commited on
Commit
56309ee
1 Parent(s): ee14c58

feat: update

Browse files
Files changed (47) hide show
  1. README copy.md +0 -13
  2. dist/assets/index-327d01f5.js +0 -0
  3. dist/assets/index-370d661c.css +1 -0
  4. dist/assets/index-ab4095ce.css +0 -1
  5. dist/assets/index-f0f38837.js +0 -0
  6. dist/assets/index-legacy-e78d22bd.js +0 -0
  7. dist/assets/index-legacy-f2aa4b0e.js +0 -0
  8. dist/index.html +3 -3
  9. frontend/React/.gitignore +0 -20
  10. frontend/React/.prettierignore +0 -7
  11. frontend/React/.prettierrc.json +0 -7
  12. frontend/React/README.md +0 -132
  13. frontend/React/index.html +0 -14
  14. frontend/React/package-lock.json +0 -0
  15. frontend/React/package.json +0 -49
  16. frontend/React/src/App.module.less +0 -54
  17. frontend/React/src/App.tsx +0 -23
  18. frontend/React/src/assets/background.png +0 -0
  19. frontend/React/src/assets/fold-icon.svg +0 -3
  20. frontend/React/src/assets/logo.svg +0 -24
  21. frontend/React/src/assets/pack-up.svg +0 -4
  22. frontend/React/src/assets/sendIcon.svg +0 -4
  23. frontend/React/src/assets/show-right-icon.png +0 -0
  24. frontend/React/src/assets/unflod-icon.svg +0 -3
  25. frontend/React/src/components/iconfont/index.tsx +0 -7
  26. frontend/React/src/config/cgi.ts +0 -2
  27. frontend/React/src/global.d.ts +0 -1
  28. frontend/React/src/index.less +0 -62
  29. frontend/React/src/index.tsx +0 -10
  30. frontend/React/src/pages/render/index.module.less +0 -848
  31. frontend/React/src/pages/render/index.tsx +0 -681
  32. frontend/React/src/pages/render/mindMapItem.tsx +0 -39
  33. frontend/React/src/routes/routes.tsx +0 -38
  34. frontend/React/src/utils/tools.ts +0 -24
  35. frontend/React/src/vite-env.d.ts +0 -9
  36. frontend/React/tsconfig.json +0 -24
  37. frontend/React/vite.config.ts +0 -62
  38. frontend/React/windows-.png +0 -0
  39. frontend/mindsearch_gradio.py +0 -142
  40. frontend/mindsearch_streamlit.py +0 -319
  41. mindsearch/__pycache__/app.cpython-310.pyc +0 -0
  42. mindsearch/agent/__init__.py +0 -66
  43. mindsearch/agent/mindsearch_agent.py +0 -408
  44. mindsearch/agent/mindsearch_prompt.py +0 -326
  45. mindsearch/agent/models.py +0 -40
  46. mindsearch/app.py +0 -128
  47. mindsearch/terminal.py +0 -50
README copy.md DELETED
@@ -1,13 +0,0 @@
1
- ---
2
- title: MindSearch
3
- emoji: 👀
4
- colorFrom: gray
5
- colorTo: indigo
6
- sdk: gradio
7
- sdk_version: 4.40.0
8
- app_file: app.py
9
- pinned: false
10
- license: apache-2.0
11
- ---
12
-
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dist/assets/index-327d01f5.js DELETED
The diff for this file is too large to render. See raw diff
 
dist/assets/index-370d661c.css ADDED
@@ -0,0 +1 @@
 
 
1
+ body,html,#root{padding:0;margin:0;width:100%;height:100%;font-family:PingFang SC;font-size:14px;line-height:21px;min-width:1280px;overflow-x:auto}#global__message-container{position:fixed;left:0;right:0;top:72px;z-index:999;display:flex;flex-direction:column;justify-content:center;align-items:center}.f{color:#6674d6;font-family:DIN;font-size:12px;font-style:normal;font-weight:500;line-height:14px;position:relative;top:-4px;padding:0 3px}.f:after{content:"·";position:absolute;top:0;right:-2px;color:#6674d6}p>:nth-last-child(1).f:after,li>:nth-last-child(1).f:after{content:"";opacity:0}.fnn2{color:#6674d6;font-family:DIN;font-size:14px;font-style:normal;font-weight:500;line-height:14px;position:relative;top:-2px}._app_1k3bk_1{height:100%;display:flex;justify-content:space-between;background:url(/assets/background-95159880.png) #f7f8ff;background-size:cover;overflow:hidden}._content_1k3bk_9{padding-top:64px;width:100%;height:100%;box-sizing:border-box}._header_1k3bk_15{position:fixed;padding:16px 32px;width:100%;display:flex;align-items:center;box-sizing:border-box}._header-nav_1k3bk_23{flex:1}._header-nav_1k3bk_23 img{height:40px}._header-nav_1k3bk_23 a{display:inline-block;text-decoration:none;color:#000}._header-nav_1k3bk_23 a:not(:first-of-type){margin-left:40px}._header-nav_1k3bk_23 a._active_1k3bk_37{font-weight:700}._header-opt_1k3bk_40{flex-shrink:0;display:flex;align-items:center}._mainPage_qbfqu_1{display:flex;justify-content:flex-start;align-items:flex-start;padding:0 60px 24px;height:100%;overflow:hidden;position:relative;min-width:1280px;max-width:1920px;margin:0 auto}._mainPage_qbfqu_1 ._chatContent_qbfqu_13{position:relative;display:flex;justify-content:flex-start;flex-direction:column;flex-grow:1;margin-right:40px;height:calc(100% - 24px);overflow-y:hidden;padding:32px 0 0;box-sizing:border-box}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._top_qbfqu_25{height:calc(100% - 110px);overflow-y:auto;margin-bottom:40px}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._top_qbfqu_25::-webkit-scrollbar{width:6px}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._top_qbfqu_25::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._top_qbfqu_25::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._question_qbfqu_41{display:flex;justify-content:flex-end;margin-bottom:40px}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._question_qbfqu_41 span{padding:12px 20px;color:#121316;font-size:14px;line-height:24px;border-radius:8px;background:#FFF;max-width:93.75%}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._sendArea_qbfqu_55{display:flex;width:100%;box-sizing:border-box;padding:10px 12px 10px 24px;justify-content:space-between;align-items:center;border-radius:8px;border:2px solid var(--fill-5, #464A53);background:#FFF;position:relative}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._sendArea_qbfqu_55 .ant-input:focus{box-shadow:none!important;outline:0!important}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._sendArea_qbfqu_55 input{height:36px;line-height:36px;flex-grow:1;border:0;outline:0}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._sendArea_qbfqu_55 input:focus{border:0;outline:0}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._sendArea_qbfqu_55 button{display:flex;justify-content:flex-start;align-items:center;border:0;background-color:#fff;cursor:pointer;padding:8px;width:65px;flex-shrink:0}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._sendArea_qbfqu_55 button img{margin-right:4px}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._notice_qbfqu_96{color:rgba(18,19,22,.35);padding-top:8px;text-align:center;font-weight:400;font-size:12px;line-height:18px}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._notice_qbfqu_96 a{text-decoration:none;color:#444;display:inline-flex;align-items:center}._mainPage_qbfqu_1 ._chatContent_qbfqu_13 ._notice_qbfqu_96 a span{font-size:18px}._mainPage_qbfqu_1 ._progressContent_qbfqu_113{width:44.44%;flex-shrink:0;box-sizing:border-box;padding:24px;border-radius:8px;border:rgba(33,38,192,.1);background:rgba(255,255,255,.8);height:calc(100% - 60px);overflow-y:auto;position:relative}._mainPage_qbfqu_1 ._progressContent_qbfqu_113::-webkit-scrollbar{width:6px}._mainPage_qbfqu_1 ._progressContent_qbfqu_113::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_qbfqu_1 ._progressContent_qbfqu_113::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_qbfqu_1 ._progressContent_qbfqu_113 ._toggleIcon_qbfqu_136{position:absolute;right:24px;top:28px;cursor:pointer}pre{margin:0;padding-top:8px;color:#121316;font-size:14px;line-height:24px;font-family:PingFang SC,Franklin Gothic Medium,Arial Narrow,Arial,sans-serif;white-space:wrap}ul{margin:0;padding:0}._draft_qbfqu_155{width:100%;white-space:wrap}._draft_qbfqu_155 ._loading_qbfqu_159,._draft_qbfqu_155 ._loading_qbfqu_159>div{position:relative;box-sizing:border-box}._draft_qbfqu_155 ._loading_qbfqu_159{display:flex;justify-content:center;align-items:center;font-size:0;color:#fff;background-color:#f90;width:20px;height:20px;border-radius:50%;margin-right:3px;flex-shrink:0}._draft_qbfqu_155 ._loading_qbfqu_159>div{display:inline-block;float:none;background-color:currentColor;border:0 solid currentColor}._draft_qbfqu_155 ._loading_qbfqu_159>div:nth-child(1){animation-delay:-.2s}._draft_qbfqu_155 ._loading_qbfqu_159>div:nth-child(2){animation-delay:-.1s}._draft_qbfqu_155 ._loading_qbfqu_159>div:nth-child(3){animation-delay:0ms}._draft_qbfqu_155 ._loading_qbfqu_159>div{width:3px;height:3px;margin:2px 1px;border-radius:100%;animation:_ball-pulse_qbfqu_1 1s ease infinite}._showRight_qbfqu_199{position:fixed;top:80px;right:-12px;width:64px;cursor:pointer}._showRight_qbfqu_199 img{width:100%}@keyframes _ball-pulse_qbfqu_1{0%,60%,to{opacity:1;transform:scale(1)}30%{opacity:.1;transform:scale(.01)}}@keyframes _moveGradient_qbfqu_1{50%{background-position:100% 50%}}@keyframes _fadeIn_qbfqu_1{0%{width:0;opacity:0}to{width:auto;opacity:1}}@keyframes _unfold_qbfqu_1{0%{height:auto}to{height:0}}._loading99_qbfqu_244{margin:20px;position:relative;width:1px;height:1px}._loading99_qbfqu_244:before,._loading99_qbfqu_244:after{position:absolute;display:inline-block;width:15px;height:15px;content:"";border-radius:100%;background-color:#5551ff}._loading99_qbfqu_244:before{left:-15px;animation:_ball-pulse_qbfqu_1 infinite .75s -.4s cubic-bezier(.2,.68,.18,1.08)}._loading99_qbfqu_244:after{right:-15px;animation:_ball-pulse_qbfqu_1 infinite .75s cubic-bezier(.2,.68,.18,1.08)}@keyframes _ball-pulse_qbfqu_1{0%{transform:scale(1);opacity:1}50%{transform:scale(.1);opacity:.6}to{transform:scale(1);opacity:1}}._rightContent_n6m4f_1{width:44.44%;flex-shrink:0;box-sizing:border-box;padding:24px;border-radius:8px;border:rgba(33,38,192,.1);background:rgba(255,255,255,.8);height:calc(100% - 24px);overflow-y:auto;position:relative}._rightContent_n6m4f_1::-webkit-scrollbar{width:6px}._rightContent_n6m4f_1::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:100px}._rightContent_n6m4f_1::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0);border-radius:100px}._rightContent_n6m4f_1 ._toggleIcon_n6m4f_24{position:absolute;right:24px;top:28px;cursor:pointer}._rightContent_n6m4f_1 ._titleNode_n6m4f_30{color:#121316;font-size:24px;font-weight:600;line-height:36px;margin-bottom:24px}._rightContent_n6m4f_1 ._conclusion_n6m4f_37{padding-top:8px;color:#121316;font-size:14px;line-height:24px}._rightContent_n6m4f_1 ._conclusion_n6m4f_37 ul{padding-left:24px}._rightContent_n6m4f_1 ._steps_n6m4f_46{margin-bottom:24px}._rightContent_n6m4f_1 ._steps_n6m4f_46 ._title_n6m4f_30{color:var(--100-text-5, #121316);font-size:20px;font-weight:600;line-height:30px;display:flex;justify-content:flex-start;align-items:center;position:relative}._rightContent_n6m4f_1 ._steps_n6m4f_46 ._title_n6m4f_30 ._open_n6m4f_59{position:absolute;right:0;font-size:20px;font-weight:400}._rightContent_n6m4f_1 ._steps_n6m4f_46 ._title_n6m4f_30 ._open_n6m4f_59 span{color:#121316;opacity:.6}._rightContent_n6m4f_1 ._steps_n6m4f_46 ._title_n6m4f_30 i{width:12px;height:12px;border-radius:50%;background-color:#2126c0;margin-right:8px}._rightContent_n6m4f_1 ._steps_n6m4f_46._thinking_n6m4f_76,._rightContent_n6m4f_1 ._steps_n6m4f_46._select_n6m4f_77{margin-bottom:24px}._rightContent_n6m4f_1 ._steps_n6m4f_46._select_n6m4f_77 ._searchList_n6m4f_80{margin-top:0!important;border-radius:8px;background:var(--fill-2, #F4F5F9);padding:8px}._rightContent_n6m4f_1 ._steps_n6m4f_46 ._con_n6m4f_37{margin-left:5px;padding-top:8px;padding-left:15px;border-left:1px solid rgba(33,38,192,.2);height:auto}._rightContent_n6m4f_1 ._steps_n6m4f_46 ._con_n6m4f_37._collapsed_n6m4f_93{overflow:hidden;height:0;padding-top:0;transition:all 1s}._rightContent_n6m4f_1 ._query_n6m4f_99,._rightContent_n6m4f_1>._searchList_n6m4f_80{margin-top:24px;margin-bottom:24px}._rightContent_n6m4f_1 ._subTitle_n6m4f_104{color:var(--100-text-5, #121316);font-size:14px;font-weight:600;line-height:24px;margin-bottom:4px}._rightContent_n6m4f_1 ._subTitle_n6m4f_104 span{margin-right:4px}._rightContent_n6m4f_1 ._query-Item_n6m4f_114{display:inline-flex;padding:4px 8px;margin-right:4px;margin-bottom:4px;border-radius:4px;border:1px solid #EBECF0;color:rgba(18,19,22,.8);font-size:14px;line-height:24px;height:32px;box-sizing:border-box;overflow:hidden}._rightContent_n6m4f_1 ._searchList_n6m4f_80{margin-top:0!important;border-radius:8px;background:var(--fill-2, #F4F5F9);padding:8px}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._thought_n6m4f_134{color:rgba(18,19,22,.8);font-size:14px;line-height:24px;margin-bottom:16px}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._scrollCon_n6m4f_140{padding-right:6px;max-height:300px;overflow-y:auto;position:relative}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._scrollCon_n6m4f_140::-webkit-scrollbar{width:6px}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._scrollCon_n6m4f_140::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:100px}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._scrollCon_n6m4f_140::-webkit-scrollbar-thumb{background-color:#d7d8dd;border-radius:100px}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._inner_n6m4f_157{width:100%;border-radius:8px;background:var(--fill-2, #F4F5F9);transition:all .5s ease;box-sizing:border-box;padding:8px}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._searchItem_n6m4f_165{border-radius:8px;background:var(---fill-0, #FFF);margin-bottom:6px;padding:4px 8px;transition:all .5s ease-in-out}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._searchItem_n6m4f_165._highLight_n6m4f_172{border:1px solid var(---Success-6, #00B365);background:linear-gradient(0deg,rgba(218,242,228,.4) 0%,rgba(218,242,228,.4) 100%),#FFF}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._searchItem_n6m4f_165 p{white-space:nowrap;max-width:95%;overflow:hidden;text-overflow:ellipsis;margin:0}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._searchItem_n6m4f_165 p._summ_n6m4f_183{color:rgba(18,19,22,.8);font-size:13px;line-height:20px;margin-bottom:2px}._rightContent_n6m4f_1 ._searchList_n6m4f_80 ._searchItem_n6m4f_165 p._url_n6m4f_189{color:var(--60-text-3, rgba(18, 19, 22, .6));font-size:12px;line-height:18px;padding-left:20px}._loading99_pj6qi_1{margin:20px;position:relative;width:1px;height:1px}._loading99_pj6qi_1:before,._loading99_pj6qi_1:after{position:absolute;display:inline-block;width:15px;height:15px;content:"";border-radius:100%;background-color:#5551ff}._loading99_pj6qi_1:before{left:-15px;animation:_ball-pulse_pj6qi_1 infinite .75s -.4s cubic-bezier(.2,.68,.18,1.08)}._loading99_pj6qi_1:after{right:-15px;animation:_ball-pulse_pj6qi_1 infinite .75s cubic-bezier(.2,.68,.18,1.08)}@keyframes _ball-pulse_pj6qi_1{0%{transform:scale(1);opacity:1}50%{transform:scale(.1);opacity:.6}to{transform:scale(1);opacity:1}}._answer_1c4d5_1{border-radius:8px;background:rgba(33,38,192,.1);padding:12px}._answer_1c4d5_1 ._inner_1c4d5_6{width:100%;background-color:#fff;border-radius:4px;padding:8px;box-sizing:border-box;transition:all .5s ease;margin-bottom:18px}._answer_1c4d5_1 ._response_1c4d5_15{color:#121316;font-size:14px;line-height:24px;padding:18px 42px}._answer_1c4d5_1 ._response_1c4d5_15 h3{font-size:24px;font-weight:600;line-height:36px;margin:0 0 16px}._answer_1c4d5_1 ._response_1c4d5_15 h4{font-size:20px;font-weight:600;line-height:30px;margin:0 0 8px}._answer_1c4d5_1 ._response_1c4d5_15 p{color:rgba(18,19,22,.8);font-size:16px;font-weight:400;line-height:28px;margin:0 0 16px}._answer_1c4d5_1 ._response_1c4d5_15 ul{margin-bottom:8px;padding-left:22px}._answer_1c4d5_1 ._response_1c4d5_15 li{color:rgba(18,19,22,.8);font-size:16px;font-weight:400;line-height:28px}._answer_1c4d5_1 ._response_1c4d5_15 li p{margin-bottom:4px}._draft_1c4d5_53{width:100%;white-space:wrap}._draft_1c4d5_53 ._loading_1c4d5_57,._draft_1c4d5_53 ._loading_1c4d5_57>div{position:relative;box-sizing:border-box}._draft_1c4d5_53 ._loading_1c4d5_57{display:flex;justify-content:center;align-items:center;font-size:0;color:#fff;background-color:#f90;width:20px;height:20px;border-radius:50%;margin-right:3px;flex-shrink:0}._draft_1c4d5_53 ._loading_1c4d5_57>div{display:inline-block;float:none;background-color:currentColor;border:0 solid currentColor}._draft_1c4d5_53 ._loading_1c4d5_57>div:nth-child(1){animation-delay:-.2s}._draft_1c4d5_53 ._loading_1c4d5_57>div:nth-child(2){animation-delay:-.1s}._draft_1c4d5_53 ._loading_1c4d5_57>div:nth-child(3){animation-delay:0ms}._draft_1c4d5_53 ._loading_1c4d5_57>div{width:3px;height:3px;margin:2px 1px;border-radius:100%;animation:_ball-pulse_1c4d5_1 1s ease infinite}._mapArea_1gwce_1{width:100%;overflow-x:auto;overflow-y:hidden}._mapArea_1gwce_1::-webkit-scrollbar{height:6px}._mapArea_1gwce_1::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:10px}._mapArea_1gwce_1::-webkit-scrollbar-thumb{background-color:#d7d8dd;border-radius:100px}._end_1gwce_17{position:absolute;right:0;background-color:#fff;display:flex;justify-content:center;align-items:center;border-left:1px solid #D7D8DD;padding-left:16px}._end_1gwce_17 ._node_1gwce_27{position:relative}._end_1gwce_17 ._node_1gwce_27:before{content:"";border:1px solid #D7D8DD;border-top:none;border-left:none;width:14px;height:0px;position:absolute;left:-16px;top:50%}._end_1gwce_17 ._node_1gwce_27 article{padding:8px 16px;border-radius:8px;border:1px solid transparent;color:#4082fe;text-align:center;font-size:14px;line-height:24px;box-sizing:border-box;background:rgba(232,233,249);color:#2126c0}._mindmap_1gwce_53{position:relative}._mindmap_1gwce_53 article{padding:6px 16px;border-radius:8px;height:38px;border:1px solid transparent;background:#FFF;color:#121316;text-align:center;font-size:14px;line-height:24px;position:relative;box-sizing:border-box}._mindmap_1gwce_53 article._loading_1gwce_69{line-height:20px;border-radius:8px;overflow:hidden;border:1px solid transparent;padding:4px}._mindmap_1gwce_53 article._loading_1gwce_69 span{color:#2126c0;background-color:#fff;border-radius:4px;line-height:24px;padding:2px 12px}._mindmap_1gwce_53 article._loading_1gwce_69 ._looping_1gwce_83{--border-width: 4px;--follow-panel-linear-border: linear-gradient(91deg, #5551FF .58%, #FF87DE 100.36%);position:absolute;top:0;left:0;width:calc(100% + var(--border-width) * 2 - 8px);height:100%;background:var(--follow-panel-linear-border);background-size:300% 300%;background-position:0 50%;animation:_moveGradient_1gwce_1 4s alternate infinite}._mindmap_1gwce_53 article._disabled_1gwce_96{border-radius:8px;border:1px solid #D7D8DD;color:rgba(18,19,22,.35)}._mindmap_1gwce_53 article._finished_1gwce_101{cursor:pointer;border:1px solid #2126C0}._mindmap_1gwce_53 article._finished_1gwce_101 ._finishDot_1gwce_105{position:absolute;top:6px;right:6px;width:6px;height:6px;background-color:#c9c0fe;border-radius:50%}._mindmap_1gwce_53 article._init_1gwce_114{border:1px solid transparent;cursor:auto}._mindmap_1gwce_53 article span{display:block;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;position:relative;z-index:20}._mindmap_1gwce_53 article span._status_1gwce_127{color:#4082fe}._mindmap_1gwce_53>li>article{border-radius:8px;background:rgba(33,38,192,.1);color:#2126c0}._mindmap_1gwce_53 li{list-style:none;display:flex;align-items:center;box-sizing:border-box;margin:16px;line-height:1;position:relative}._mindmap_1gwce_53 li>ul._onlyone_1gwce_144:before{opacity:0}._mindmap_1gwce_53 li>ul._onlyone_1gwce_144>li{margin-left:0}._mindmap_1gwce_53 li>ul._onlyone_1gwce_144>li:after{opacity:0}._mindmap_1gwce_53 li>ul:before{content:"";border:1px solid #D7D8DD;border-top:none;border-left:none;width:14px;height:0px;position:absolute;left:0;top:50%}._mindmap_1gwce_53 li:before{content:"";border:1px solid #D7D8DD;border-top:none;border-left:none;width:16px;height:0px;position:absolute;left:-17px}._mindmap_1gwce_53 li:after{content:"";border:1px solid #D7D8DD;border-top:none;border-left:none;width:0px;height:calc(50% + 33px);position:absolute;left:-18px}._mindmap_1gwce_53 li:first-of-type:after{top:50%}._mindmap_1gwce_53 li:last-of-type:after{bottom:50%}._mindmap_1gwce_53 li ul{padding:0 0 0 16px;position:relative}._mindmap_1gwce_53>li:after,._mindmap_1gwce_53>li:before{display:none}._mindmap_1gwce_53 ._endLine_1gwce_198{border-bottom:1px solid #D7D8DD;width:3000px;transition:width 1s ease-in-out}@keyframes _moveGradient_1gwce_1{50%{background-position:100% 50%}}article{padding:6px 16px;border-radius:8px;height:38px;border:1px solid transparent;background:#FFF;color:#121316;text-align:center;font-size:14px;line-height:24px;position:relative;box-sizing:border-box}article._loading_1phxi_14{line-height:20px;border-radius:8px;overflow:hidden;border:1px solid transparent;padding:4px}article._loading_1phxi_14 span{color:#2126c0;background-color:#fff;border-radius:4px;line-height:24px;padding:2px 12px}article._loading_1phxi_14 ._looping_1phxi_28{--border-width: 4px;--follow-panel-linear-border: linear-gradient(91deg, #5551FF .58%, #FF87DE 100.36%);position:absolute;top:0;left:0;width:calc(100% + var(--border-width) * 2 - 8px);height:100%;background:var(--follow-panel-linear-border);background-size:300% 300%;background-position:0 50%;animation:_moveGradient_1phxi_1 4s alternate infinite}article._disabled_1phxi_41{border-radius:8px;border:1px solid #D7D8DD;color:rgba(18,19,22,.35)}article._finished_1phxi_46{cursor:pointer;border:1px solid #2126C0}article._finished_1phxi_46 ._finishDot_1phxi_50{position:absolute;top:6px;right:6px;width:6px;height:6px;background-color:#c9c0fe;border-radius:50%}article._init_1phxi_59{border:1px solid transparent;cursor:auto}article span{display:block;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;position:relative;z-index:20}article span._status_1phxi_72{color:#4082fe}ul._onlyone_1phxi_75:before{opacity:0}ul._onlyone_1phxi_75>li{margin-left:0}ul._onlyone_1phxi_75>li:after{opacity:0}._endLine_1phxi_84{border-bottom:1px solid #D7D8DD;width:3000px;transition:width 1s ease-in-out}@keyframes _moveGradient_1phxi_1{50%{background-position:100% 50%}}
dist/assets/index-ab4095ce.css DELETED
@@ -1 +0,0 @@
1
- body,html,#root{padding:0;margin:0;width:100%;height:100%;font-family:PingFang SC;font-size:14px;line-height:21px}#global__message-container{position:fixed;left:0;right:0;top:72px;z-index:999;display:flex;flex-direction:column;justify-content:center;align-items:center}.f{color:#6674d6;font-family:DIN;font-size:12px;font-style:normal;font-weight:500;line-height:14px;position:relative;top:-4px;padding:0 3px}.f:after{content:"·";position:absolute;top:0;right:-2px;color:#6674d6}p>:nth-last-child(1).f:after,li>:nth-last-child(1).f:after{content:"";opacity:0}.fnn2{color:#6674d6;font-family:DIN;font-size:14px;font-style:normal;font-weight:500;line-height:14px;position:relative;top:-2px}._app_1k3bk_1{height:100%;display:flex;justify-content:space-between;background:url(/assets/background-95159880.png) #f7f8ff;background-size:cover;overflow:hidden}._content_1k3bk_9{padding-top:64px;width:100%;height:100%;box-sizing:border-box}._header_1k3bk_15{position:fixed;padding:16px 32px;width:100%;display:flex;align-items:center;box-sizing:border-box}._header-nav_1k3bk_23{flex:1}._header-nav_1k3bk_23 img{height:40px}._header-nav_1k3bk_23 a{display:inline-block;text-decoration:none;color:#000}._header-nav_1k3bk_23 a:not(:first-of-type){margin-left:40px}._header-nav_1k3bk_23 a._active_1k3bk_37{font-weight:700}._header-opt_1k3bk_40{flex-shrink:0;display:flex;align-items:center}._mainPage_6absh_1{display:flex;justify-content:flex-start;align-items:flex-start;padding:0 60px 60px;height:100%;overflow:hidden;position:relative;min-width:1280px;max-width:1920px;margin:0 auto}._mainPage_6absh_1 ._chatContent_6absh_13{position:relative;display:flex;justify-content:flex-start;flex-direction:column;flex-grow:1;margin-right:40px;height:calc(100% - 60px);overflow-y:hidden;padding:32px 0;box-sizing:border-box}._mainPage_6absh_1 ._chatContent_6absh_13 ._top_6absh_25{height:calc(100% - 110px);overflow-y:auto;margin-bottom:40px}._mainPage_6absh_1 ._chatContent_6absh_13 ._top_6absh_25::-webkit-scrollbar{width:6px}._mainPage_6absh_1 ._chatContent_6absh_13 ._top_6absh_25::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_6absh_1 ._chatContent_6absh_13 ._top_6absh_25::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_6absh_1 ._chatContent_6absh_13 ._question_6absh_41{display:flex;justify-content:flex-end;margin-bottom:40px}._mainPage_6absh_1 ._chatContent_6absh_13 ._question_6absh_41 span{padding:12px 20px;color:#121316;font-size:14px;line-height:24px;border-radius:8px;background:#FFF;max-width:93.75%}._mainPage_6absh_1 ._chatContent_6absh_13 ._end_6absh_55{position:absolute;right:0;background-color:#fff;display:flex;justify-content:center;align-items:center;border-left:1px solid #D7D8DD;padding-left:16px}._mainPage_6absh_1 ._chatContent_6absh_13 ._end_6absh_55 ._node_6absh_65{position:relative}._mainPage_6absh_1 ._chatContent_6absh_13 ._end_6absh_55 ._node_6absh_65:before{content:"";border:1px solid #D7D8DD;border-top:none;border-left:none;width:14px;height:0px;position:absolute;left:-16px;top:50%}._mainPage_6absh_1 ._chatContent_6absh_13 ._end_6absh_55 ._node_6absh_65 article{padding:8px 16px;border-radius:8px;border:1px solid transparent;color:#4082fe;text-align:center;font-size:14px;line-height:24px;box-sizing:border-box;background:rgba(232,233,249);color:#2126c0}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91{border-radius:8px;background:rgba(33,38,192,.1);padding:12px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._inner_6absh_96{width:100%;background-color:#fff;border-radius:4px;padding:8px;box-sizing:border-box;transition:all .5s ease;margin-bottom:18px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._inner_6absh_96 ._mapArea_6absh_105{width:100%;overflow-x:auto;overflow-y:hidden}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._inner_6absh_96 ._mapArea_6absh_105::-webkit-scrollbar{height:6px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._inner_6absh_96 ._mapArea_6absh_105::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:10px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._inner_6absh_96 ._mapArea_6absh_105::-webkit-scrollbar-thumb{background-color:#d7d8dd;border-radius:100px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._response_6absh_121{color:#121316;font-size:14px;line-height:24px;padding:18px 42px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._response_6absh_121 h3{font-size:24px;font-weight:600;line-height:36px;margin:0 0 16px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._response_6absh_121 h4{font-size:20px;font-weight:600;line-height:30px;margin:0 0 8px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._response_6absh_121 p{color:rgba(18,19,22,.8);font-size:16px;font-weight:400;line-height:28px;margin:0 0 16px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._response_6absh_121 ul{margin-bottom:8px;padding-left:22px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._response_6absh_121 li{color:rgba(18,19,22,.8);font-size:16px;font-weight:400;line-height:28px}._mainPage_6absh_1 ._chatContent_6absh_13 ._answer_6absh_91 ._response_6absh_121 li p{margin-bottom:4px}._mainPage_6absh_1 ._chatContent_6absh_13 ._sendArea_6absh_159{display:flex;width:100%;box-sizing:border-box;padding:10px 12px 10px 24px;justify-content:space-between;align-items:center;border-radius:8px;border:2px solid var(--fill-5, #464A53);background:#FFF;position:relative}._mainPage_6absh_1 ._chatContent_6absh_13 ._sendArea_6absh_159 .ant-input:focus{box-shadow:none!important;outline:0!important}._mainPage_6absh_1 ._chatContent_6absh_13 ._sendArea_6absh_159 input{height:36px;line-height:36px;flex-grow:1;border:0;outline:0}._mainPage_6absh_1 ._chatContent_6absh_13 ._sendArea_6absh_159 input:focus{border:0;outline:0}._mainPage_6absh_1 ._chatContent_6absh_13 ._sendArea_6absh_159 button{display:flex;justify-content:flex-start;align-items:center;border:0;background-color:#fff;cursor:pointer;padding:8px;width:65px;flex-shrink:0}._mainPage_6absh_1 ._chatContent_6absh_13 ._sendArea_6absh_159 button img{margin-right:4px}._mainPage_6absh_1 ._chatContent_6absh_13 ._notice_6absh_200{color:rgba(18,19,22,.35);padding-top:8px;text-align:center;font-weight:400}._mainPage_6absh_1 ._chatContent_6absh_13 ._notice_6absh_200 a{text-decoration:none;color:#444;display:inline-flex;align-items:center}._mainPage_6absh_1 ._chatContent_6absh_13 ._notice_6absh_200 a span{font-size:18px}._mainPage_6absh_1 ._progressContent_6absh_215{width:44.44%;flex-shrink:0;box-sizing:border-box;padding:24px;border-radius:8px;border:rgba(33,38,192,.1);background:rgba(255,255,255,.8);height:calc(100% - 60px);overflow-y:auto;position:relative}._mainPage_6absh_1 ._progressContent_6absh_215::-webkit-scrollbar{width:6px}._mainPage_6absh_1 ._progressContent_6absh_215::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_6absh_1 ._progressContent_6absh_215::-webkit-scrollbar-thumb{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_6absh_1 ._progressContent_6absh_215 ._toggleIcon_6absh_238{position:absolute;right:24px;top:28px;cursor:pointer}._mainPage_6absh_1 ._progressContent_6absh_215 ._titleNode_6absh_244{color:#121316;font-size:24px;font-weight:600;line-height:36px;margin-bottom:24px}._mainPage_6absh_1 ._progressContent_6absh_215 ._conclusion_6absh_251{padding-top:8px;color:#121316;font-size:14px;line-height:24px}._mainPage_6absh_1 ._progressContent_6absh_215 ._conclusion_6absh_251 ul{padding-left:24px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._title_6absh_244{color:var(--100-text-5, #121316);font-size:20px;font-weight:600;line-height:30px;display:flex;justify-content:flex-start;align-items:center;position:relative}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._title_6absh_244 ._open_6absh_270{position:absolute;right:0;font-size:20px;font-weight:400}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._title_6absh_244 ._open_6absh_270 span{color:#121316;opacity:.6}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._title_6absh_244 i{width:12px;height:12px;border-radius:50%;background-color:#2126c0;margin-right:8px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260._thinking_6absh_287,._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260._select_6absh_288{margin-bottom:24px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260._select_6absh_288 ._searchList_6absh_291{margin-top:0!important;border-radius:8px;background:var(--fill-2, #F4F5F9);padding:8px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251{margin-left:5px;padding-top:8px;padding-left:15px;border-left:1px solid rgba(33,38,192,.2);height:auto}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251._collapsed_6absh_304{overflow:hidden;height:0;padding-top:0;transition:all 1s}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._subTitle_6absh_310{color:var(--100-text-5, #121316);font-size:14px;font-weight:600;line-height:24px;margin-bottom:4px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._subTitle_6absh_310 span{margin-right:4px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._query_6absh_320,._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251>._searchList_6absh_291{margin-top:24px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._query-Item_6absh_324{display:inline-flex;padding:4px 8px;margin-right:4px;margin-bottom:4px;border-radius:4px;border:1px solid #EBECF0;color:rgba(18,19,22,.8);font-size:14px;line-height:24px;height:32px;box-sizing:border-box;overflow:hidden}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._thought_6absh_338{color:rgba(18,19,22,.8);font-size:14px;line-height:24px;margin-bottom:16px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._scrollCon_6absh_344{padding-right:6px;max-height:300px;overflow-y:auto;position:relative}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._scrollCon_6absh_344::-webkit-scrollbar{width:6px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._scrollCon_6absh_344::-webkit-scrollbar-track{background-color:rgba(255,255,255,0);border-radius:100px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._scrollCon_6absh_344::-webkit-scrollbar-thumb{background-color:#d7d8dd;border-radius:100px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._inner_6absh_96{width:100%;border-radius:8px;background:var(--fill-2, #F4F5F9);transition:all .5s ease;box-sizing:border-box;padding:8px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._searchItem_6absh_369{border-radius:8px;background:var(---fill-0, #FFF);margin-bottom:6px;padding:4px 8px;transition:all .5s ease-in-out}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._searchItem_6absh_369._highLight_6absh_376{border:1px solid var(---Success-6, #00B365);background:linear-gradient(0deg,rgba(218,242,228,.4) 0%,rgba(218,242,228,.4) 100%),#FFF}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._searchItem_6absh_369 p{white-space:nowrap;max-width:95%;overflow:hidden;text-overflow:ellipsis;margin:0}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._searchItem_6absh_369 p._summ_6absh_387{color:rgba(18,19,22,.8);font-size:13px;line-height:20px;margin-bottom:2px}._mainPage_6absh_1 ._progressContent_6absh_215 ._steps_6absh_260 ._con_6absh_251 ._searchList_6absh_291 ._searchItem_6absh_369 p._url_6absh_393{color:var(--60-text-3, rgba(18, 19, 22, .6));font-size:12px;line-height:18px;padding-left:20px}pre{margin:0;padding-top:8px;color:#121316;font-size:14px;line-height:24px;font-family:PingFang SC,Franklin Gothic Medium,Arial Narrow,Arial,sans-serif;white-space:wrap}ul{margin:0;padding:0}._draft_6absh_412{width:100%;white-space:wrap;position:relative}._draft_6absh_412 ._loading_6absh_417,._draft_6absh_412 ._loading_6absh_417>div{position:relative;box-sizing:border-box}._draft_6absh_412 ._loading_6absh_417{display:flex;justify-content:center;align-items:center;font-size:0;color:#fff;background-color:#f90;width:20px;height:20px;border-radius:50%;margin-right:3px;flex-shrink:0;position:absolute;top:0;left:0}._draft_6absh_412 ._loading_6absh_417>div{display:inline-block;float:none;background-color:currentColor;border:0 solid currentColor}._draft_6absh_412 ._loading_6absh_417>div:nth-child(1){animation-delay:-.2s}._draft_6absh_412 ._loading_6absh_417>div:nth-child(2){animation-delay:-.1s}._draft_6absh_412 ._loading_6absh_417>div:nth-child(3){animation-delay:0ms}._draft_6absh_412 ._loading_6absh_417>div{width:3px;height:3px;margin:2px 1px;border-radius:100%;animation:_ball-pulse_6absh_1 1s ease infinite}._mindmap_6absh_460{position:relative}._mindmap_6absh_460 article{padding:6px 16px;border-radius:8px;height:38px;border:1px solid transparent;background:#FFF;color:#121316;text-align:center;font-size:14px;line-height:24px;position:relative;box-sizing:border-box}._mindmap_6absh_460 article._loading_6absh_417{line-height:20px;border-radius:8px;overflow:hidden;border:1px solid transparent;padding:4px}._mindmap_6absh_460 article._loading_6absh_417 span{color:#2126c0;background-color:#fff;border-radius:4px;line-height:24px;padding:2px 12px}._mindmap_6absh_460 article._loading_6absh_417 ._looping_6absh_490{--border-width: 4px;--follow-panel-linear-border: linear-gradient(91deg, #5551FF .58%, #FF87DE 100.36%);position:absolute;top:0;left:0;width:calc(100% + var(--border-width) * 2 - 8px);height:100%;background:var(--follow-panel-linear-border);background-size:300% 300%;background-position:0 50%;animation:_moveGradient_6absh_1 4s alternate infinite}._mindmap_6absh_460 article._disabled_6absh_503{border-radius:8px;border:1px solid #D7D8DD;color:rgba(18,19,22,.35)}._mindmap_6absh_460 article._finished_6absh_508{border:1px solid #2126C0}._mindmap_6absh_460 article._finished_6absh_508 ._finishDot_6absh_511{position:absolute;top:6px;right:6px;width:6px;height:6px;background-color:#c9c0fe;border-radius:50%}._mindmap_6absh_460 article._init_6absh_520{border:1px solid transparent;cursor:auto}._mindmap_6absh_460 article span{display:block;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;position:relative;z-index:20}._mindmap_6absh_460 article span._status_6absh_533{color:#4082fe}._mindmap_6absh_460>li>article{border-radius:8px;background:rgba(33,38,192,.1);color:#2126c0}._mindmap_6absh_460 li{list-style:none;display:flex;align-items:center;box-sizing:border-box;margin:16px;line-height:1;position:relative}._mindmap_6absh_460 li>ul._onlyone_6absh_550:before{opacity:0}._mindmap_6absh_460 li>ul._onlyone_6absh_550>li{margin-left:0}._mindmap_6absh_460 li>ul._onlyone_6absh_550>li:after{opacity:0}._mindmap_6absh_460 li>ul:before{content:"";border:1px solid #D7D8DD;border-top:none;border-left:none;width:14px;height:0px;position:absolute;left:0;top:50%}._mindmap_6absh_460 li:before{content:"";border:1px solid #D7D8DD;border-top:none;border-left:none;width:16px;height:0px;position:absolute;left:-17px}._mindmap_6absh_460 li:after{content:"";border:1px solid #D7D8DD;border-top:none;border-left:none;width:0px;height:calc(50% + 33px);position:absolute;left:-18px}._mindmap_6absh_460 li:first-of-type:after{top:50%}._mindmap_6absh_460 li:last-of-type:after{bottom:50%}._mindmap_6absh_460 li ul{padding:0 0 0 16px;position:relative}._mindmap_6absh_460>li:after,._mindmap_6absh_460>li:before{display:none}._mindmap_6absh_460 ._endLine_6absh_604{border-bottom:1px solid #D7D8DD;width:3000px;transition:width 1s ease-in-out}._showRight_6absh_609{position:fixed;top:80px;right:-10px;width:42px;cursor:pointer}._showRight_6absh_609 img{width:100%}@keyframes _ball-pulse_6absh_1{0%,60%,to{opacity:1;transform:scale(1)}30%{opacity:.1;transform:scale(.01)}}@keyframes _moveGradient_6absh_1{50%{background-position:100% 50%}}@keyframes _fadeIn_6absh_1{0%{width:0;opacity:0}to{width:auto;opacity:1}}@keyframes _unfold_6absh_1{0%{height:auto}to{height:0}}._loading99_6absh_654{margin:20px;position:relative;width:1px;height:1px}._loading99_6absh_654:before,._loading99_6absh_654:after{position:absolute;display:inline-block;width:15px;height:15px;content:"";border-radius:100%;background-color:#5551ff}._loading99_6absh_654:before{left:-15px;animation:_ball-pulse_6absh_1 infinite .75s -.4s cubic-bezier(.2,.68,.18,1.08)}._loading99_6absh_654:after{right:-15px;animation:_ball-pulse_6absh_1 infinite .75s cubic-bezier(.2,.68,.18,1.08)}@keyframes _ball-pulse_6absh_1{0%{transform:scale(1);opacity:1}50%{transform:scale(.1);opacity:.6}to{transform:scale(1);opacity:1}}
 
 
dist/assets/index-f0f38837.js ADDED
The diff for this file is too large to render. See raw diff
 
dist/assets/index-legacy-e78d22bd.js ADDED
The diff for this file is too large to render. See raw diff
 
dist/assets/index-legacy-f2aa4b0e.js DELETED
The diff for this file is too large to render. See raw diff
 
dist/index.html CHANGED
@@ -5,8 +5,8 @@
5
  <link rel="icon" type="image/svg+xml" href="" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title></title>
8
- <script type="module" crossorigin src="/assets/index-327d01f5.js"></script>
9
- <link rel="stylesheet" href="/assets/index-ab4095ce.css">
10
  <script type="module">import.meta.url;import("_").catch(()=>1);async function* g(){};if(location.protocol!="file:"){window.__vite_is_modern_browser=true}</script>
11
  <script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
12
  </head>
@@ -16,6 +16,6 @@
16
 
17
  <script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
18
  <script nomodule crossorigin id="vite-legacy-polyfill" src="/assets/polyfills-legacy-0b55db5f.js"></script>
19
- <script nomodule crossorigin id="vite-legacy-entry" data-src="/assets/index-legacy-f2aa4b0e.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
20
  </body>
21
  </html>
 
5
  <link rel="icon" type="image/svg+xml" href="" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
  <title></title>
8
+ <script type="module" crossorigin src="/assets/index-f0f38837.js"></script>
9
+ <link rel="stylesheet" href="/assets/index-370d661c.css">
10
  <script type="module">import.meta.url;import("_").catch(()=>1);async function* g(){};if(location.protocol!="file:"){window.__vite_is_modern_browser=true}</script>
11
  <script type="module">!function(){if(window.__vite_is_modern_browser)return;console.warn("vite: loading legacy chunks, syntax error above and the same error below should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>
12
  </head>
 
16
 
17
  <script nomodule>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",(function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()}),!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script>
18
  <script nomodule crossorigin id="vite-legacy-polyfill" src="/assets/polyfills-legacy-0b55db5f.js"></script>
19
+ <script nomodule crossorigin id="vite-legacy-entry" data-src="/assets/index-legacy-e78d22bd.js">System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))</script>
20
  </body>
21
  </html>
frontend/React/.gitignore DELETED
@@ -1,20 +0,0 @@
1
-
2
- # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
3
-
4
- # dependencies
5
- /node_modules
6
- /.pnp
7
- .pnp.js
8
-
9
- # testing
10
- /coverage
11
-
12
- # production
13
- /build
14
-
15
- # misc
16
- .DS_Store
17
-
18
- npm-debug.log*
19
- yarn-debug.log*
20
- yarn-error.log*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/.prettierignore DELETED
@@ -1,7 +0,0 @@
1
- dist
2
- deploy
3
- values
4
- node_modules
5
- .gitignore
6
- .prettierignore
7
- .husky
 
 
 
 
 
 
 
 
frontend/React/.prettierrc.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "tabWidth": 4,
4
- "singleQuote": true,
5
- "quoteProps": "as-needed",
6
- "bracketSpacing": true
7
- }
 
 
 
 
 
 
 
 
frontend/React/README.md DELETED
@@ -1,132 +0,0 @@
1
- # 开始
2
- ## 准备node.js开发环境
3
- Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境,允许你在服务器端运行 JavaScript。以下是在 Windows、Linux 和 macOS 上安装 Node.js 的详细步骤。
4
-
5
- ### 在 Windows 上安装 Node.js
6
- - 步骤 1: 访问 Node.js 官网
7
-
8
- 打开浏览器,访问 [Node.js](https://nodejs.org/zh-cn/download/prebuilt-installer) 官方网站。
9
-
10
- - 步骤 2: 下载 Node.js 安装包
11
-
12
- 选择你需要的nodejs版本,设备的类型,点击下载,示例如下图:
13
- ![windows install](./windows-.png)
14
-
15
- - 步骤 3: 安装 Node.js
16
-
17
- 双击下载的安装包开始安装。
18
-
19
- 跟随安装向导的指示进行安装。在安装过程中,你可以选择安装位置、是否将 Node.js 添加到系统 PATH 环境变量等选项。推荐选择“添加到 PATH”以便在任何地方都能通过命令行访问 Node.js。
20
- 安装完成后,点击“Finish”结束安装。
21
-
22
- - 步骤 4: 验证安装
23
-
24
- 打开命令提示符(CMD)或 PowerShell。
25
- 输入 node -v 并回车,如果系统返回了 Node.js 的版本号,说明安装成功。
26
- 接着,输入 npm -v 并回车,npm 是 Node.js 的包管理器,如果返回了版本号,表示 npm 也已正确安装。
27
-
28
- ### 在 Linux 上安装 Node.js
29
- 注意: 由于 Linux 发行版众多,以下以 Ubuntu 为例说明,其他发行版(如 CentOS、Debian 等)的安装方式可能略有不同,可自行查询对应的安装办法。
30
-
31
- - 步骤 1: 更新你的包管理器
32
-
33
- 打开终端。
34
-
35
- 输入 sudo apt update 并回车,以更新 Ubuntu 的包索引。
36
-
37
- - 步骤 2: 安装 Node.js
38
-
39
- 对于 Ubuntu 18.04 及更高版本,Node.js 可以直接从 Ubuntu 的仓库中安装。
40
- 输入 sudo apt install nodejs npm 并回车。
41
- 对于旧版本的 Ubuntu 或需要安装特定版本的 Node.js,你可能需要使用如 NodeSource 这样的第三方仓库。
42
-
43
- - 步骤 3: 验证安装
44
-
45
- 在终端中,输入 node -v 和 npm -v 来验证 Node.js 和 npm 是否已正确安装。
46
-
47
- ### 在 macOS 上安装 Node.js
48
-
49
- #### 下载安装
50
- - 步骤 1: 访问 Node.js 官网
51
-
52
- 打开浏览器,访问 Node.js 官方网站。
53
-
54
- - 步骤 2: 下载 Node.js 安装包
55
-
56
- 在首页找到 macOS 对应的安装包(通常是 .pkg 文件),点击下载。
57
-
58
- - 步骤 3: 安装 Node.js
59
-
60
- 找到下载的 .pkg 文件,双击打开。
61
- 跟随安装向导的指示进行安装。
62
- 安装完成后,点击“Close”结束安装。
63
-
64
- - 步骤 4: 验证安装
65
-
66
- 打开终端。
67
-
68
- 输入 node -v 和 npm -v 来验证 Node.js 和 npm 是否已正确安装。
69
-
70
- #### 使用HomeBrew安装
71
- 前提条件:确保你的macOS上已经安装了Homebrew。如果尚未安装,可以通过以下命令进行安装(以终端操作为例):
72
- ```
73
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
74
- ```
75
- 按照提示输入密码以确认安装。安装过程中,可能需要你同意许可协议等。
76
-
77
- - 打开终端:
78
- 在macOS上找到并打开“终端”应用程序。
79
-
80
- - 使用Homebrew安装Node.js:
81
- 在终端中输入以下命令来安装最新版本的Node.js
82
- ```
83
- brew install node
84
- ```
85
- Homebrew会自动下载Node.js的安装包,并处理相关的依赖项和安装过程。你需要等待一段时间,直到安装完成。
86
-
87
- - 验证安装:
88
- 安装完成后,你可以通过输入以下命令来验证Node.js是否成功安装:
89
- ```
90
- node -v
91
- ```
92
- 如果终端输出了Node.js的版本号,那么表示安装成功。同时,你也可以通过输入npm -v来验证npm(Node.js的包管理器)是否也成功安装。
93
-
94
- 完成以上步骤后,你应该能在你的 Windows、Linux 或 macOS 系统上成功安装并运行 Node.js。
95
-
96
- ### 更多
97
- 如需了解更多,可参照:https://nodejs.org/en
98
-
99
- 如环境已经准备好,跳转下一步
100
-
101
- ## 安装依赖
102
- 进入前端项目根目录
103
- ```
104
- npm install
105
- ```
106
-
107
- ## 启动
108
- ```
109
- npm start
110
- ```
111
-
112
- 启动成功后,界面将出现可访问的本地url
113
-
114
- ## 配置
115
- ### 接口请求配置
116
- - 如您需要配置的服务支持跨域,可至/src/config/cgi.ts中修改请求链接,请求链接为http://ip:port/path;
117
- - 如您需要配置的服务不支持跨域,可至vite.config.ts中配置proxy,示例如下:
118
-
119
- ```
120
- server: {
121
- port: 8080,
122
- proxy: {
123
- "/solve": {
124
- target: "https://example.com",
125
- changeOrigin: true,
126
- }
127
- }
128
- }
129
- ```
130
-
131
- ## 知悉
132
- - 前端服务基于react开发,如需了解react相关知识,可参考:https://react.dev/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/index.html DELETED
@@ -1,14 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title></title>
8
- </head>
9
-
10
- <body>
11
- <div id="root"></div>
12
- <script type="module" src="/src/index.tsx"></script>
13
- </body>
14
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/package-lock.json DELETED
The diff for this file is too large to render. See raw diff
 
frontend/React/package.json DELETED
@@ -1,49 +0,0 @@
1
- {
2
- "name": "test-react-flow",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "scripts": {
7
- "start": "vite --host --mode dev",
8
- "build": "tsc && vite build",
9
- "preview": "vite preview",
10
- "prettier": "prettier --write ."
11
- },
12
- "devDependencies": {
13
- "@babel/plugin-proposal-optional-chaining": "^7.21.0",
14
- "@types/classnames": "^2.3.1",
15
- "@types/js-cookie": "^3.0.3",
16
- "@types/node": "^18.15.11",
17
- "@types/react": "^18.0.28",
18
- "@types/react-dom": "^18.0.11",
19
- "@vitejs/plugin-legacy": "^4.0.2",
20
- "@vitejs/plugin-react": "^3.1.0",
21
- "husky": "^9.0.11",
22
- "less": "^4.1.3",
23
- "lint-staged": "^15.2.7",
24
- "prettier": "^3.0.0",
25
- "react": "^18.2.0",
26
- "react-dom": "^18.2.0",
27
- "terser": "^5.16.9",
28
- "typescript": "^4.9.3",
29
- "vite": "^4.2.1",
30
- "vite-babel-plugin": "^0.0.2"
31
- },
32
- "dependencies": {
33
- "@antv/x6": "^2.18.1",
34
- "@microsoft/fetch-event-source": "^2.0.1",
35
- "antd": "^5.18.3",
36
- "axios": "^1.3.5",
37
- "classnames": "^2.5.1",
38
- "elkjs": "^0.9.3",
39
- "js-cookie": "^3.0.1",
40
- "react-markdown": "^9.0.1",
41
- "react-router": "^6.11.2",
42
- "react-router-dom": "^6.11.2",
43
- "reactflow": "^11.11.3",
44
- "rehype-raw": "^7.0.0"
45
- },
46
- "lint-staged": {
47
- "**/*.{ts, tsx, less, module.less, json, md, .html}": "prettier --write ."
48
- }
49
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/App.module.less DELETED
@@ -1,54 +0,0 @@
1
- .app {
2
- height: 100%;
3
- display: flex;
4
- justify-content: space-between;
5
- background: url(./assets/background.png) rgb(247, 248, 255);
6
- background-size: cover;
7
- overflow: hidden;
8
- }
9
-
10
- .content {
11
- padding-top: 64px;
12
- width: 100%;
13
- height: 100%;
14
- box-sizing: border-box;
15
- // display: flex;
16
- // justify-content: center;
17
- }
18
-
19
- .header {
20
- position: fixed;
21
- padding: 16px 32px;
22
- width: 100%;
23
- display: flex;
24
- align-items: center;
25
- box-sizing: border-box;
26
-
27
- &-nav {
28
- flex: 1;
29
-
30
- img {
31
- height: 40px;
32
- }
33
-
34
- a {
35
- display: inline-block;
36
- text-decoration: none;
37
- color: black;
38
-
39
- &:not(:first-of-type) {
40
- margin-left: 40px;
41
- }
42
-
43
- &.active {
44
- font-weight: bold;
45
- }
46
- }
47
- }
48
-
49
- &-opt {
50
- flex-shrink: 0;
51
- display: flex;
52
- align-items: center;
53
- }
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/App.tsx DELETED
@@ -1,23 +0,0 @@
1
- import style from "./App.module.less";
2
- import Logo from "@/assets/logo.svg";
3
- import { BrowserRouter } from "react-router-dom";
4
- import RouterRoutes from "@/routes/routes";
5
-
6
- function App() {
7
- return (
8
- <BrowserRouter>
9
- <div className={style.app} id="app">
10
- <div className={style.header}>
11
- <div className={style.headerNav}>
12
- <img src={Logo} />
13
- </div>
14
- </div>
15
- <div className={style.content}>
16
- <RouterRoutes />
17
- </div>
18
- </div>
19
- </BrowserRouter>
20
- );
21
- }
22
-
23
- export default App;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/assets/background.png DELETED
Binary file (36.9 kB)
 
frontend/React/src/assets/fold-icon.svg DELETED
frontend/React/src/assets/logo.svg DELETED
frontend/React/src/assets/pack-up.svg DELETED
frontend/React/src/assets/sendIcon.svg DELETED
frontend/React/src/assets/show-right-icon.png DELETED
Binary file (8.87 kB)
 
frontend/React/src/assets/unflod-icon.svg DELETED
frontend/React/src/components/iconfont/index.tsx DELETED
@@ -1,7 +0,0 @@
1
- import { createFromIconfontCN } from "@ant-design/icons";
2
-
3
- const IconFont = createFromIconfontCN({
4
- scriptUrl: "//at.alicdn.com/t/c/font_3858115_p8dw9q83s0h.js"
5
- });
6
-
7
- export default IconFont;
 
 
 
 
 
 
 
 
frontend/React/src/config/cgi.ts DELETED
@@ -1,2 +0,0 @@
1
- export const mode = import.meta.env.MODE;
2
- export const GET_SSE_DATA = '/solve';
 
 
 
frontend/React/src/global.d.ts DELETED
@@ -1 +0,0 @@
1
- declare module 'event-source-polyfill';
 
 
frontend/React/src/index.less DELETED
@@ -1,62 +0,0 @@
1
- body,
2
- html,
3
- #root {
4
- padding: 0;
5
- margin: 0;
6
- width: 100%;
7
- height: 100%;
8
- font-family: "PingFang SC";
9
- font-size: 14px;
10
- line-height: 21px;
11
- }
12
-
13
- #global__message-container {
14
- position: fixed;
15
- left: 0;
16
- right: 0;
17
- top: 72px;
18
- z-index: 999;
19
- display: flex;
20
- flex-direction: column;
21
- justify-content: center;
22
- align-items: center;
23
- }
24
-
25
- .f {
26
- color: #6674D6;
27
- font-family: DIN;
28
- font-size: 12px;
29
- font-style: normal;
30
- font-weight: 500;
31
- line-height: 14px;
32
- position: relative;
33
- top: -4px;
34
- padding: 0 3px;
35
-
36
- &::after {
37
- content: '·';
38
- position: absolute;
39
- top: 0;
40
- right: -2px;
41
- color: #6674D6;
42
- }
43
- }
44
-
45
- p> :nth-last-child(1).f,
46
- li> :nth-last-child(1).f {
47
- &::after {
48
- content: '';
49
- opacity: 0;
50
- }
51
- }
52
-
53
- .fnn2 {
54
- color: #6674D6;
55
- font-family: DIN;
56
- font-size: 14px;
57
- font-style: normal;
58
- font-weight: 500;
59
- line-height: 14px;
60
- position: relative;
61
- top: -2px;
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/index.tsx DELETED
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import ReactDOM from "react-dom/client";
3
- import "./index.less";
4
- import App from "./App";
5
-
6
- ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
7
- <React.StrictMode>
8
- <App />
9
- </React.StrictMode>,
10
- );
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/pages/render/index.module.less DELETED
@@ -1,848 +0,0 @@
1
- // inspired by https://www.youtube.com/watch?v=Pl1Gw14pS2I
2
- .mainPage {
3
- display: flex;
4
- justify-content: flex-start;
5
- align-items: flex-start;
6
- padding: 0 60px 60px;
7
- height: 100%;
8
- overflow: hidden;
9
- position: relative;
10
- min-width: 1280px;
11
- max-width: 1920px;
12
- margin: 0 auto;
13
-
14
- .chatContent {
15
- position: relative;
16
- display: flex;
17
- justify-content: flex-start;
18
- flex-direction: column;
19
- flex-grow: 1;
20
- margin-right: 40px;
21
- height: calc(100% - 60px);
22
- overflow-y: hidden;
23
- padding: 32px 0;
24
- box-sizing: border-box;
25
-
26
- .top {
27
- height: calc(100% - 110px);
28
- overflow-y: auto;
29
- margin-bottom: 40px;
30
- }
31
-
32
- .top::-webkit-scrollbar {
33
- width: 6px;
34
- }
35
-
36
- .top::-webkit-scrollbar-track {
37
- background-color: rgba(255, 255, 255, 0);
38
- border-radius: 100px;
39
- }
40
-
41
- .top::-webkit-scrollbar-thumb {
42
- background-color: rgba(255, 255, 255, 0);
43
- border-radius: 100px;
44
- }
45
-
46
- .question {
47
- display: flex;
48
- justify-content: flex-end;
49
- margin-bottom: 40px;
50
-
51
- span {
52
- padding: 12px 20px;
53
- color: #121316;
54
- font-size: 14px;
55
- line-height: 24px;
56
- border-radius: 8px;
57
- background: #FFF;
58
- max-width: 93.75%;
59
- }
60
- }
61
-
62
- .end {
63
- position: absolute;
64
- right: 0;
65
- background-color: #fff;
66
- display: flex;
67
- justify-content: center;
68
- align-items: center;
69
- border-left: 1px solid #D7D8DD;
70
- padding-left: 16px;
71
-
72
- .node {
73
- position: relative;
74
-
75
- &::before {
76
- content: "";
77
- border: 1px solid #D7D8DD;
78
- border-top: none;
79
- border-left: none;
80
- width: calc(16px - 2px);
81
- height: 0px;
82
- position: absolute;
83
- left: -16px;
84
- top: 50%;
85
- // transform: translateY(-50%);
86
- }
87
-
88
- article {
89
- padding: 8px 16px;
90
- border-radius: 8px;
91
- border: 1px solid transparent;
92
- color: #4082FE;
93
- text-align: center;
94
- font-size: 14px;
95
- line-height: 24px;
96
- box-sizing: border-box;
97
- background: rgba(232, 233, 249);
98
- color: #2126C0;
99
- }
100
- }
101
- }
102
-
103
- .answer {
104
- border-radius: 8px;
105
- background: rgba(33, 38, 192, 0.10);
106
- padding: 12px;
107
-
108
- .inner {
109
- width: 100%;
110
- background-color: #fff;
111
- border-radius: 4px;
112
- padding: 8px;
113
- box-sizing: border-box;
114
- transition: all 0.5s ease;
115
- margin-bottom: 18px;
116
-
117
- .mapArea {
118
- width: 100%;
119
- overflow-x: auto;
120
- overflow-y: hidden;
121
-
122
- &::-webkit-scrollbar {
123
- height: 6px;
124
- }
125
-
126
- &::-webkit-scrollbar-track {
127
- background-color: rgba(255, 255, 255, 0);
128
- border-radius: 10px;
129
- }
130
-
131
- &::-webkit-scrollbar-thumb {
132
- background-color: #d7d8dd;
133
- border-radius: 100px;
134
- }
135
- }
136
-
137
- }
138
-
139
-
140
- .response {
141
- color: #121316;
142
- font-size: 14px;
143
- line-height: 24px;
144
- padding: 18px 42px;
145
-
146
- h3 {
147
- font-size: 24px;
148
- font-weight: 600;
149
- line-height: 36px;
150
- margin: 0 0 16px 0;
151
- }
152
-
153
- h4 {
154
- font-size: 20px;
155
- font-weight: 600;
156
- line-height: 30px;
157
- margin: 0 0 8px 0;
158
- }
159
-
160
- p {
161
- color: rgba(18, 19, 22, 0.80);
162
- font-size: 16px;
163
- font-weight: 400;
164
- line-height: 28px;
165
- margin: 0 0 16px 0;
166
- }
167
-
168
- ul {
169
- margin-bottom: 8px;
170
- padding-left: 22px;
171
- }
172
-
173
- li {
174
- color: rgba(18, 19, 22, 0.80);
175
- font-size: 16px;
176
- font-weight: 400;
177
- line-height: 28px;
178
-
179
- p {
180
- margin-bottom: 4px;
181
- }
182
- }
183
- }
184
- }
185
-
186
- .sendArea {
187
- display: flex;
188
- width: 100%;
189
- box-sizing: border-box;
190
- padding: 10px 12px 10px 24px;
191
- justify-content: space-between;
192
- align-items: center;
193
- border-radius: 8px;
194
- border: 2px solid var(--fill-5, #464A53);
195
- background: #FFF;
196
- position: relative;
197
-
198
- :global {
199
- .ant-input {
200
- &:focus {
201
- box-shadow: none !important;
202
- outline: 0 !important;
203
- }
204
- }
205
- }
206
-
207
- input {
208
- height: 36px;
209
- line-height: 36px;
210
- flex-grow: 1;
211
- border: 0;
212
- outline: 0;
213
-
214
- &:focus {
215
- border: 0;
216
- outline: 0;
217
- }
218
- }
219
-
220
- button {
221
- display: flex;
222
- justify-content: flex-start;
223
- align-items: center;
224
- border: 0;
225
- background-color: #fff;
226
- cursor: pointer;
227
- padding: 8px;
228
- width: 65px;
229
- flex-shrink: 0;
230
-
231
- img {
232
- margin-right: 4px;
233
- }
234
- }
235
- }
236
-
237
- .notice {
238
- color: #12131659;
239
- padding-top: 8px;
240
- text-align: center;
241
- font-weight: 400;
242
-
243
- a {
244
- text-decoration: none;
245
- color: #444;
246
- display: inline-flex;
247
- align-items: center;
248
-
249
- span {
250
- font-size: 18px;
251
- }
252
- }
253
- }
254
- }
255
-
256
- .progressContent {
257
- width: 44.44%;
258
- flex-shrink: 0;
259
- box-sizing: border-box;
260
- padding: 24px;
261
- border-radius: 8px;
262
- border: rgba(33, 38, 192, 0.10);
263
- background: rgba(255, 255, 255, 0.80);
264
- height: calc(100% - 60px);
265
- overflow-y: auto;
266
- position: relative;
267
-
268
- &::-webkit-scrollbar {
269
- width: 6px;
270
- }
271
-
272
- &::-webkit-scrollbar-track {
273
- background-color: rgba(255, 255, 255, 0);
274
- border-radius: 100px;
275
- }
276
-
277
- &::-webkit-scrollbar-thumb {
278
- background-color: rgba(255, 255, 255, 0);
279
- border-radius: 100px;
280
- }
281
-
282
- .toggleIcon {
283
- position: absolute;
284
- right: 24px;
285
- top: 28px;
286
- cursor: pointer;
287
- }
288
-
289
- .titleNode {
290
- color: #121316;
291
- font-size: 24px;
292
- font-weight: 600;
293
- line-height: 36px;
294
- margin-bottom: 24px;
295
- }
296
-
297
- .conclusion {
298
- padding-top: 8px;
299
- color: #121316;
300
- font-size: 14px;
301
- line-height: 24px;
302
-
303
- ul {
304
- padding-left: 24px;
305
- }
306
- }
307
-
308
- .steps {
309
- .title {
310
- color: var(--100-text-5, #121316);
311
- font-size: 20px;
312
- font-weight: 600;
313
- line-height: 30px;
314
- display: flex;
315
- justify-content: flex-start;
316
- align-items: center;
317
- position: relative;
318
-
319
- .open {
320
- position: absolute;
321
- right: 0;
322
- font-size: 20px;
323
- font-weight: normal;
324
-
325
- span {
326
- color: #121316;
327
- opacity: 0.6;
328
- }
329
- }
330
-
331
- i {
332
- width: 12px;
333
- height: 12px;
334
- border-radius: 50%;
335
- background-color: #2126C0;
336
- margin-right: 8px;
337
- }
338
- }
339
-
340
- &.thinking,
341
- &.select {
342
- margin-bottom: 24px;
343
- }
344
-
345
- &.select {
346
- .searchList {
347
- margin-top: 0 !important;
348
- border-radius: 8px;
349
- background: var(--fill-2, #F4F5F9);
350
- padding: 8px;
351
- }
352
- }
353
-
354
- .con {
355
- margin-left: 5px;
356
- padding-top: 8px;
357
- padding-left: 15px;
358
- border-left: 1px solid rgba(33, 38, 192, 0.20);
359
- height: auto;
360
-
361
- &.collapsed {
362
- overflow: hidden;
363
- height: 0;
364
- padding-top: 0;
365
- transition: all 1s;
366
- }
367
-
368
- .subTitle {
369
- color: var(--100-text-5, #121316);
370
- font-size: 14px;
371
- font-weight: 600;
372
- line-height: 24px;
373
- margin-bottom: 4px;
374
-
375
- span {
376
- margin-right: 4px;
377
- }
378
- }
379
-
380
- .query,
381
- >.searchList {
382
- margin-top: 24px;
383
- // margin-bottom: 24px;
384
- }
385
-
386
- .query {
387
- &-Item {
388
- display: inline-flex;
389
- padding: 4px 8px;
390
- margin-right: 4px;
391
- margin-bottom: 4px;
392
- border-radius: 4px;
393
- border: 1px solid #EBECF0;
394
- color: rgba(18, 19, 22, 0.80);
395
- font-size: 14px;
396
- line-height: 24px;
397
- height: 32px;
398
- box-sizing: border-box;
399
- overflow: hidden;
400
- // animation: fadeIn linear 2s;
401
- }
402
- }
403
-
404
- .searchList {
405
- .thought {
406
- color: rgba(18, 19, 22, 0.80);
407
- font-size: 14px;
408
- line-height: 24px;
409
- margin-bottom: 16px;
410
- }
411
-
412
- .scrollCon {
413
- padding-right: 6px;
414
- max-height: 300px;
415
- overflow-y: auto;
416
- position: relative;
417
- }
418
-
419
- .scrollCon::-webkit-scrollbar {
420
- width: 6px;
421
- }
422
-
423
- .scrollCon::-webkit-scrollbar-track {
424
- background-color: rgba(255, 255, 255, 0);
425
- border-radius: 100px;
426
- }
427
-
428
- .scrollCon::-webkit-scrollbar-thumb {
429
- background-color: #d7d8dd;
430
- border-radius: 100px;
431
- }
432
-
433
- .inner {
434
- width: 100%;
435
- border-radius: 8px;
436
- background: var(--fill-2, #F4F5F9);
437
- transition: all 0.5s ease;
438
- box-sizing: border-box;
439
- padding: 8px;
440
- }
441
-
442
- .searchItem {
443
- border-radius: 8px;
444
- background: var(---fill-0, #FFF);
445
- margin-bottom: 6px;
446
- padding: 4px 8px;
447
- transition: all 0.5s ease-in-out;
448
-
449
- &.highLight {
450
- border: 1px solid var(---Success-6, #00B365);
451
- background: linear-gradient(0deg, rgba(218, 242, 228, 0.40) 0%, rgba(218, 242, 228, 0.40) 100%), #FFF;
452
- }
453
-
454
- p {
455
- white-space: nowrap;
456
- max-width: 95%;
457
- overflow: hidden;
458
- text-overflow: ellipsis;
459
- margin: 0;
460
- }
461
-
462
- p.summ {
463
- color: rgba(18, 19, 22, 0.80);
464
- font-size: 13px;
465
- line-height: 20px;
466
- margin-bottom: 2px;
467
- }
468
-
469
- p.url {
470
- color: var(--60-text-3, rgba(18, 19, 22, 0.60));
471
- font-size: 12px;
472
- line-height: 18px;
473
- padding-left: 20px;
474
- }
475
- }
476
- }
477
-
478
-
479
- }
480
- }
481
- }
482
- }
483
-
484
- pre {
485
- margin: 0;
486
- padding-top: 8px;
487
- color: #121316;
488
- font-size: 14px;
489
- line-height: 24px;
490
- font-family: 'PingFang SC', 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
491
- white-space: wrap;
492
- }
493
-
494
- ul {
495
- margin: 0;
496
- padding: 0;
497
- }
498
-
499
- .draft {
500
- width: 100%;
501
- white-space: wrap;
502
- // display: flex;
503
- // justify-content: flex-start;
504
- // align-items: flex-start;
505
- position: relative;
506
-
507
- .loading,
508
- .loading>div {
509
- position: relative;
510
- box-sizing: border-box;
511
- }
512
-
513
- .loading {
514
- display: flex;
515
- justify-content: center;
516
- align-items: center;
517
- font-size: 0;
518
- color: #fff;
519
- background-color: #f90;
520
- width: 20px;
521
- height: 20px;
522
- border-radius: 50%;
523
- margin-right: 3px;
524
- flex-shrink: 0;
525
- position: absolute;
526
- top: 0;
527
- left: 0;
528
- }
529
-
530
- .loading>div {
531
- display: inline-block;
532
- float: none;
533
- background-color: currentColor;
534
- border: 0 solid currentColor;
535
- }
536
-
537
- .loading>div:nth-child(1) {
538
- animation-delay: -200ms;
539
- }
540
-
541
- .loading>div:nth-child(2) {
542
- animation-delay: -100ms;
543
- }
544
-
545
- .loading>div:nth-child(3) {
546
- animation-delay: 0ms;
547
- }
548
-
549
- .loading>div {
550
- width: 3px;
551
- height: 3px;
552
- margin: 2px 1px;
553
- border-radius: 100%;
554
- animation: ball-pulse 1s ease infinite;
555
- }
556
- }
557
-
558
- .mindmap {
559
- position: relative;
560
-
561
- article {
562
- padding: 6px 16px;
563
- border-radius: 8px;
564
- height: 38px;
565
- border: 1px solid transparent;
566
- background: #FFF;
567
- color: #121316;
568
- text-align: center;
569
- font-size: 14px;
570
- line-height: 24px;
571
- position: relative;
572
- box-sizing: border-box;
573
-
574
- &.loading {
575
- line-height: 20px;
576
- border-radius: 8px;
577
- overflow: hidden;
578
- border: 1px solid transparent;
579
- padding: 4px;
580
-
581
- span {
582
- color: #2126C0;
583
- background-color: #fff;
584
- border-radius: 4px;
585
- line-height: 24px;
586
- padding: 2px 12px;
587
- }
588
-
589
- .looping {
590
- --border-width: 4px;
591
- --follow-panel-linear-border: linear-gradient(91deg,
592
- #5551FF 0.58%,
593
- #FF87DE 100.36%);
594
-
595
- position: absolute;
596
- top: 0;
597
- left: 0;
598
- width: calc(100% + var(--border-width) * 2 - 8px);
599
- height: calc(100%);
600
- background: var(--follow-panel-linear-border);
601
- background-size: 300% 300%;
602
- background-position: 0 50%;
603
- animation: moveGradient 4s alternate infinite;
604
- }
605
- }
606
-
607
- &.disabled {
608
- border-radius: 8px;
609
- border: 1px solid #D7D8DD;
610
- color: rgba(18, 19, 22, 0.35);
611
- }
612
-
613
- &.finished {
614
- // cursor: pointer;
615
- border: 1px solid #2126C0;
616
-
617
- .finishDot {
618
- position: absolute;
619
- top: 6px;
620
- right: 6px;
621
- width: 6px;
622
- height: 6px;
623
- background-color: #C9C0FE;
624
- border-radius: 50%;
625
- }
626
- }
627
-
628
- &.init {
629
- border: 1px solid transparent;
630
- cursor: auto;
631
- }
632
-
633
- span {
634
- display: block;
635
- white-space: nowrap;
636
- max-width: 160px;
637
- overflow: hidden;
638
- text-overflow: ellipsis;
639
- position: relative;
640
- z-index: 20;
641
- }
642
-
643
- span.status {
644
- color: #4082FE;
645
- }
646
-
647
- }
648
-
649
- // 第一个article,起始节点
650
- >li {
651
- >article {
652
- border-radius: 8px;
653
- background: rgba(33, 38, 192, 0.10);
654
- color: #2126C0;
655
- }
656
- }
657
-
658
- li {
659
- list-style: none;
660
- display: flex;
661
- align-items: center;
662
- box-sizing: border-box;
663
- margin: 16px;
664
- line-height: 1;
665
- position: relative;
666
-
667
- &>ul.onlyone {
668
- &:before {
669
- opacity: 0;
670
- }
671
-
672
- >li {
673
- margin-left: 0px;
674
- }
675
-
676
- &>li:after {
677
- opacity: 0;
678
- }
679
-
680
- &>li:before {
681
- // left: 0;
682
- }
683
- }
684
-
685
- &>ul:before {
686
- content: "";
687
- border: 1px solid #D7D8DD;
688
- border-top: none;
689
- border-left: none;
690
- width: calc(16px - 2px);
691
- height: 0px;
692
- position: absolute;
693
- left: 0;
694
- top: 50%;
695
- // transform: translateY(-50%);
696
- }
697
-
698
- &:before {
699
- content: "";
700
- border: 1px solid #D7D8DD;
701
- border-top: none;
702
- border-left: none;
703
- width: 16px;
704
- height: 0px;
705
- position: absolute;
706
- left: calc(-16px - 1px);
707
- }
708
-
709
- &:after {
710
- content: "";
711
- border: 1px solid #D7D8DD;
712
- border-top: none;
713
- border-left: none;
714
- width: 0px;
715
- height: calc(100% / 2 + 33px);
716
- position: absolute;
717
- left: calc(-16px - 2px);
718
- }
719
-
720
- &:first-of-type:after {
721
- top: 50%;
722
- }
723
-
724
- &:last-of-type:after {
725
- bottom: 50%;
726
- }
727
-
728
- ul {
729
- padding: 0 0 0 16px;
730
- position: relative;
731
- }
732
- }
733
-
734
- &>li {
735
-
736
- &:after,
737
- &:before {
738
- display: none;
739
- }
740
- }
741
-
742
- .endLine {
743
- border-bottom: 1px solid #D7D8DD;
744
- width: 3000px;
745
- transition: width 1s ease-in-out;
746
- }
747
- }
748
-
749
- .showRight {
750
- position: fixed;
751
- top: 80px;
752
- right: -10px;
753
- width: 42px;
754
- cursor: pointer;
755
-
756
- img {
757
- width: 100%;
758
- }
759
- }
760
-
761
- @keyframes ball-pulse {
762
-
763
- 0%,
764
- 60%,
765
- 100% {
766
- opacity: 1;
767
- transform: scale(1);
768
- }
769
-
770
- 30% {
771
- opacity: 0.1;
772
- transform: scale(0.01);
773
- }
774
- }
775
-
776
- @keyframes moveGradient {
777
- 50% {
778
- background-position: 100% 50%;
779
- }
780
- }
781
-
782
- @keyframes fadeIn {
783
- 0% {
784
- width: 0;
785
- opacity: 0;
786
- }
787
-
788
- 100% {
789
- width: auto;
790
- opacity: 1;
791
- }
792
- }
793
-
794
- @keyframes unfold {
795
- 0% {
796
- height: auto;
797
- }
798
-
799
- 100% {
800
- height: 0;
801
- }
802
- }
803
-
804
-
805
- .loading99 {
806
- margin: 20px;
807
- position: relative;
808
- width: 1px;
809
- height: 1px;
810
- }
811
-
812
- .loading99:before,
813
- .loading99:after {
814
- position: absolute;
815
- display: inline-block;
816
- width: 15px;
817
- height: 15px;
818
- content: "";
819
- border-radius: 100%;
820
- background-color: #5551FF;
821
- }
822
-
823
- .loading99:before {
824
- left: -15px;
825
- animation: ball-pulse infinite 0.75s -0.4s cubic-bezier(0.2, 0.68, 0.18, 1.08);
826
- }
827
-
828
- .loading99:after {
829
- right: -15px;
830
- animation: ball-pulse infinite 0.75s cubic-bezier(0.2, 0.68, 0.18, 1.08);
831
- }
832
-
833
- @keyframes ball-pulse {
834
- 0% {
835
- transform: scale(1);
836
- opacity: 1;
837
- }
838
-
839
- 50% {
840
- transform: scale(0.1);
841
- opacity: 0.6;
842
- }
843
-
844
- 100% {
845
- transform: scale(1);
846
- opacity: 1;
847
- }
848
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/pages/render/index.tsx DELETED
@@ -1,681 +0,0 @@
1
- import styles from './index.module.less';
2
- import { useEffect, useState, useRef, Children } from 'react';
3
- import MindMapItem from './mindMapItem';
4
- import PackIcon from '@/assets/pack-up.svg';
5
- import SendIcon from '@/assets/sendIcon.svg';
6
- import { Tooltip, Input, message } from 'antd';
7
- import IconFont from '@/components/iconfont';
8
- import ReactMarkdown from "react-markdown";
9
- import ShowRightIcon from "@/assets/show-right-icon.png";
10
- import rehypeRaw from 'rehype-raw';
11
- import classNames from 'classnames';
12
- import { fetchEventSource } from '@microsoft/fetch-event-source';
13
- import { GET_SSE_DATA } from '@/config/cgi';
14
- import { replaceStr } from '@/utils/tools';
15
-
16
- const RenderTest = () => {
17
- let eventSource: any = null;
18
- let sseTimer: any = useRef(null);
19
- const [isWaiting, setIsWaiting] = useState(false);
20
- const [question, setQuestion] = useState("");
21
- const [stashQuestion, setStashQuestion] = useState("");
22
- const [isEnd, setIsEnd] = useState(false);
23
- const [showEndNode, setShowEndNode] = useState(false);
24
- // 一组节点的渲染草稿
25
- const [draft, setDraft] = useState('');
26
- // 一轮完整对话结束
27
- const [chatIsOver, setChatIsOver] = useState(true);
28
- // 一组节点的思考草稿是不是打印结束
29
- const [draftEnd, setDraftEnd] = useState(false);
30
-
31
- const [progress1, setProgress1] = useState('');
32
- const [progress2, setProgress2] = useState('');
33
- const [progressEnd, setProgressEnd] = useState(false);
34
-
35
- const [conclusion, setConclusion] = useState('');
36
- const [stashConclusion, setstashConclusion] = useState('');
37
-
38
- const [query, setQuery] = useState([]);
39
- const [searchList, setSearchList] = useState([]);
40
- // 整体的渲染树
41
- const [renderData, setRenderData] = useState<any[]>([]);
42
- const [currentNode, setCurrentNode] = useState<any>(null);
43
- // 渲染minddata里的第几个item
44
- const [renderIndex, setRenderIndex] = useState<number>(0);
45
- const [response, setResponse] = useState("");
46
- const [currentStep, setCurrentStep] = useState(0);
47
- // steps展开收起的信息
48
- const [collapseInfo, setCollapseInfo] = useState([true, true]);
49
- const [mapWidth, setMapWidth] = useState(0);
50
- // 是否展示右侧内容
51
- const [showRight, setShowRight] = useState(true);
52
-
53
- const [currentNodeRendering, setCurrentNodeRendering] = useState(false);
54
- const [selectedIds, setSelectedIds] = useState([]);
55
- const [nodeName, setNodeName] = useState('');
56
- const hasHighlight = useRef(false);
57
- const conclusionRender = useRef(false);
58
- const nodeDraftRender = useRef(false);
59
- const [obj, setObj] = useState<any>(null);
60
- const [nodeOutputEnd, setNodeEnd] = useState(false);
61
- const [adjList, setAdjList] = useState([]);
62
-
63
- const TEXT_INTERVAL = 20;
64
- const SEARCHLIST_INTERVAL = 80;
65
-
66
-
67
- const toggleRight = () => {
68
- setShowRight(!showRight);
69
- };
70
-
71
- const findAndUpdateStatus = (nodes: any[], targetNode: any) => {
72
- return nodes.map((node) => {
73
- if (node.state === 1 && node.id !== 0) {
74
- return { ...node, state: 3 };
75
- }
76
-
77
- if (node.name === targetNode) {
78
- return { ...node, state: 1 };
79
- }
80
-
81
- if (node.children) {
82
- // 递归地在子节点中查找
83
- node.children = findAndUpdateStatus(node.children, targetNode);
84
- }
85
-
86
- return node;
87
- });
88
- }
89
-
90
- const generateEndStyle = () => {
91
- // 获取所有class为endline的div元素
92
- const endlineDivs = document.getElementsByClassName('endline');
93
- const mindMap = document.getElementById("mindMap");
94
- // 确保至少有两个元素
95
- if (endlineDivs.length >= 2 && mindMap) {
96
- // 获取第一个和最后一个元素的边界框(bounding rectangle)
97
- const firstRect = endlineDivs[0].getBoundingClientRect();
98
- const lastRect = endlineDivs[endlineDivs.length - 1].getBoundingClientRect();
99
- const mindMapRect = mindMap?.getBoundingClientRect();
100
- // 计算y值的差值
101
- const yDiff = lastRect.top - firstRect.top;
102
- // const top = firstRect.top - mindMapRect.top;
103
- // 如果需要包含元素的完整高度(不仅仅是顶部位置),可以加上元素的高度
104
- // const yDiffWithHeight = yDiff + (lastRect.height - firstRect.height);
105
- return {
106
- top: firstRect.top - mindMapRect.top,
107
- height: yDiff + 1
108
- };
109
- } else {
110
- return {
111
- top: '50%',
112
- height: 0
113
- };
114
- }
115
- };
116
-
117
- const generateWidth = () => {
118
- const articles = document.querySelectorAll('article');
119
- // 确保至少有两个元素
120
- if (articles?.length) {
121
- let maxRight = 0;
122
- articles.forEach((item, index) => {
123
- if (item.getBoundingClientRect().right > maxRight) {
124
- maxRight = item.getBoundingClientRect().right;
125
- }
126
- })
127
- const firstArticle = articles[0].getBoundingClientRect();
128
- if (maxRight - firstArticle.left + 200 > mapWidth) {
129
- return maxRight - firstArticle.left + 200
130
- } else {
131
- return mapWidth;
132
- }
133
- } else {
134
- return 100;
135
- }
136
- };
137
-
138
- // 逐字渲染
139
- const renderDraft = (str: string, type: string, endCallback: () => void) => {
140
- // 已经输出的字符数量
141
- let outputIndex = 0;
142
-
143
- // 输出字符的函数
144
- const outputText = () => {
145
- // 给出高亮后draft输出的结束标志
146
- if (type === 'stepDraft-1' && outputIndex + 3 > str?.length) {
147
- nodeDraftRender.current = true;
148
- }
149
- // 如果还有字符未输出
150
- if (outputIndex < str?.length) {
151
- // 获取接下来要输出的1个字符(或剩余字符,如果不足3个)
152
- let chunk = str.slice(outputIndex, Math.min(outputIndex + 10, str.length));
153
- // 更新已输出字符的索引
154
- outputIndex += chunk.length;
155
- if (type === 'thought') {
156
- setDraft(str.slice(0, outputIndex));
157
- } else if (type === "stepDraft-0") {
158
- setProgress1(str.slice(0, outputIndex));
159
- } else if (type === "stepDraft-1") {
160
- setProgress2(str.slice(0, outputIndex));
161
- } else if (type === "conclusion") {
162
- setConclusion(str.slice(0, outputIndex));
163
- } else if (type === "response") {
164
- setResponse(str.slice(0, outputIndex));
165
- }
166
- } else {
167
- // 如果没有更多字符需要输出,则清除定时器
168
- clearInterval(intervalId);
169
- endCallback && endCallback()
170
- }
171
- }
172
-
173
- // 设定定时器ID
174
- let intervalId = setInterval(outputText, TEXT_INTERVAL);
175
- }
176
-
177
- // 渲染搜索结果renderSearchList
178
- const renderSearchList = () => {
179
- let outputIndex = 0;
180
- const content = JSON.parse(currentNode.actions[currentStep].result[0].content);
181
-
182
- const arr: any = Object.keys(content).map(item => {
183
- return { id: item, ...content[item] };
184
- });
185
- const len = Object.keys(content).length;
186
- const outputText = () => {
187
- outputIndex++;
188
- if (outputIndex < len + 1) {
189
- setSearchList(arr.slice(0, outputIndex));
190
- } else {
191
- clearInterval(intervalId);
192
- }
193
- };
194
- // 设定定时器ID
195
- let intervalId = setInterval(outputText, SEARCHLIST_INTERVAL);
196
- };
197
-
198
- // 高亮searchList
199
- const highLightSearchList = (ids: any) => {
200
- setSelectedIds([]);
201
- const newStep = currentStep + 1;
202
- setCurrentStep(newStep);
203
- const highlightArr: any = [...searchList];
204
- highlightArr.forEach((item: any) => {
205
- if (ids.includes(Number(item.id))) {
206
- item.highLight = true;
207
- }
208
- })
209
- highlightArr.sort((item1: any, item2: any) => {
210
- if (item1.highLight === item2.highLight) {
211
- return 0;
212
- }
213
- // 如果item1是highlight,放在前面
214
- if (item1.highLight) {
215
- return -1;
216
- }
217
- // 如果item2是highlight,放在后面
218
- return 1;
219
- })
220
- setSearchList(highlightArr);
221
- renderDraft(currentNode.actions[1].thought, `stepDraft-1`, () => { });
222
- hasHighlight.current = true; // 标记为高亮已执行
223
- };
224
-
225
- // 渲染结论
226
- const renderConclusion = () => {
227
- const res = window.localStorage.getItem('nodeRes') || '';
228
- const replaced = replaceStr(res);
229
- // setTimeout(() => { setCollapseInfo([false, false]); }, 2000);
230
- setCollapseInfo([false, false]);
231
- setConclusion(replaced);
232
- setstashConclusion(res);
233
- // 给出conclusion结束的条件
234
- if (stashConclusion.length + 5 > res.length) {
235
- conclusionRender.current = true;
236
- setProgressEnd(true);
237
- }
238
- };
239
-
240
- // 渲染query
241
- const renderQuery = (endCallback: () => void) => {
242
- const queries = currentNode.actions[currentStep]?.args?.query;
243
- setQuery(queries);
244
- endCallback && endCallback();
245
- };
246
-
247
- const renderSteps = () => {
248
- setCurrentNodeRendering(true);
249
- const queryEndCallback = () => {
250
- if (currentNode.actions[currentStep].result[0].content) {
251
- if (currentNode.actions[currentStep].type === "BingBrowser.search" || currentNode.actions[currentStep].type === "BingBrowser") {
252
- renderSearchList();
253
- }
254
- }
255
- };
256
- const thoughtEndCallback = () => {
257
- if (currentNode.actions[currentStep]?.args?.query?.length) {
258
- renderQuery(queryEndCallback);
259
- } else {
260
- queryEndCallback();
261
- }
262
- };
263
- if (currentNode.actions[currentStep].thought) {
264
- renderDraft(currentNode.actions[currentStep].thought, `stepDraft-${currentStep}`, thoughtEndCallback);
265
- }
266
- }
267
-
268
- // 展开收起
269
- const toggleCard = (index: number) => {
270
- const arr = [...collapseInfo];
271
- arr[index] = !arr[index];
272
- setCollapseInfo(arr);
273
- };
274
-
275
- // 渲染过程中保持渲染文字可见
276
- const keepScrollTop = (divA: any, divB: any) => {
277
- // 获取 divB 的当前高度
278
- const bHeight = divB.offsetHeight;
279
-
280
- // 检查 divA 是否需要滚动(即 divB 的高度是否大于 divA 的可视高度)
281
- if (bHeight > divA.offsetHeight) {
282
- // 滚动到 divB 的底部在 divA 的可视区域内
283
- divA.scrollTop = bHeight - divA.offsetHeight;
284
- }
285
- };
286
-
287
- useEffect(() => {
288
- setRenderData([
289
- {
290
- id: 0,
291
- state: 3,
292
- name: '原始问题',
293
- children: adjList
294
- }
295
- ])
296
- }, [JSON.stringify(adjList)]);
297
-
298
- useEffect(() => {
299
- console.log('render data changed-----', renderData);
300
- }, [renderData]);
301
-
302
- useEffect(() => {
303
- if (currentStep === 1) {
304
- setCollapseInfo([false, true]);
305
- }
306
- }, [currentStep]);
307
-
308
- useEffect(() => {
309
- if (nodeOutputEnd && !localStorage.getItem('nodeRes')) {
310
- // 如果节点输出结束了,但是response还没有结束,认为节点渲染已结束
311
- conclusionRender.current = true;
312
- setProgressEnd(true);
313
- return;
314
- }
315
- if (nodeDraftRender.current && localStorage.getItem('nodeRes')) {
316
- renderConclusion();
317
- }
318
- }, [localStorage.getItem('nodeRes'), nodeDraftRender.current, nodeOutputEnd]);
319
-
320
- useEffect(() => {
321
- if (obj?.response?.nodes[obj.current_node]?.detail?.state !== 1) {
322
- setIsWaiting(true);
323
- }
324
- if (obj?.response?.nodes?.[obj.current_node].detail?.state === 0 && currentNode?.current_node === obj.current_node) {
325
- console.log('node render end-----', obj);
326
- setNodeEnd(true);
327
- }
328
-
329
- if (obj?.current_node && obj?.response?.state === 3) {
330
- // 当node节点的数据可以开始渲染时,给currentnode赋值
331
- // update conclusion
332
- if (obj.response.nodes[obj.current_node]?.detail?.actions?.length === 2 &&
333
- obj.response.nodes[obj.current_node]?.detail?.state === 1 &&
334
- obj.response.nodes[obj.current_node]?.detail.response) {
335
- window.localStorage.setItem('nodeRes', obj.response.nodes[obj.current_node]?.detail.response);
336
- }
337
- if (obj.current_node &&
338
- (obj.response.nodes[obj.current_node]?.detail?.state === 1) &&
339
- obj.response.nodes[obj.current_node]?.detail?.actions?.length &&
340
- currentStep === 0 &&
341
- currentNode?.current_node !== obj?.current_node
342
- ) {
343
- // 更新当前渲染节点
344
- console.log('update current node----');
345
- setIsWaiting(false);
346
- setCurrentNode({ ...obj.response.nodes[obj.current_node]?.detail, current_node: obj.current_node });
347
- }
348
-
349
- // 设置highlight
350
- if (!selectedIds.length &&
351
- obj.response.nodes[obj.current_node]?.detail?.actions?.[1]?.type === 'BingBrowser.select' &&
352
- (obj.response.nodes[obj.current_node]?.detail?.state === 1)) {
353
- setSelectedIds(obj.response.nodes[obj.current_node]?.detail?.actions?.[1]?.args?.select_ids || []);
354
- setCurrentNode({ ...obj.response.nodes[obj.current_node]?.detail, current_node: obj.current_node });
355
- }
356
- }
357
- }, [obj]);
358
-
359
- useEffect(() => {
360
- // 输出思考过程
361
- if (!currentNode || currentNodeRendering) { return; }
362
- renderSteps();
363
- }, [currentNode, currentNodeRendering, selectedIds]);
364
-
365
- useEffect(() => {
366
- if (!hasHighlight.current && selectedIds.length && currentNode?.actions.length === 2) {
367
- // 渲染高亮的search信息
368
- highLightSearchList(selectedIds);
369
- }
370
- }, [selectedIds, currentNode]);
371
-
372
- useEffect(() => {
373
- // 当前节点渲染结束
374
- if (nodeName && nodeName !== currentNode?.current_node && progressEnd && !isEnd) {
375
- resetNode(nodeName);
376
- setMapWidth(generateWidth());
377
- }
378
- }, [nodeName, currentNode, progressEnd, isEnd]);
379
-
380
- let responseTimer: any = useRef(null);
381
- useEffect(() => {
382
- if (isEnd) {
383
- responseTimer.current = setInterval(() => {
384
- const divA = document.getElementById('chatArea') as HTMLDivElement;
385
- const divB = document.getElementById('messageWindowId') as HTMLDivElement;
386
- keepScrollTop(divA, divB);
387
- if (chatIsOver) {
388
- clearInterval(responseTimer.current);
389
- }
390
- }, 500);
391
- setTimeout(() => {
392
- setShowEndNode(true);
393
- }, 300);
394
- } else if (responseTimer.current) {
395
- // 如果 isEnd 变为 false,清除定时器
396
- clearInterval(responseTimer.current);
397
- responseTimer.current = null;
398
- }
399
-
400
- // 返回清理函数,确保组件卸载时清除定时器
401
- return () => {
402
- if (responseTimer.current) {
403
- clearInterval(responseTimer.current);
404
- responseTimer.current = null;
405
- }
406
- };
407
- }, [isEnd, chatIsOver]);
408
-
409
- useEffect(() => {
410
- setRenderData([]);
411
- setResponse('');
412
- setDraft('');
413
- setIsEnd(false);
414
- setShowRight(true);
415
- window.localStorage.setItem('nodeRes', '');
416
- window.localStorage.setItem('finishedNodes', '');
417
- }, [question]);
418
-
419
- const resetNode = (targetNode: string) => {
420
- if (targetNode === 'response') return; // 如果开始response了,所有节点都渲染完了,不需要reset
421
- // 渲染下一个节点前,初始化状态
422
- const newData = findAndUpdateStatus(renderData, targetNode);
423
- console.log('reset node------', targetNode, renderData);
424
- setCurrentStep(0);
425
- setQuery([]);
426
- setSearchList([]);
427
- setConclusion('');
428
- setCollapseInfo([true, true]);
429
- setProgress1('');
430
- setProgress2('');
431
- setProgressEnd(false);
432
- setCurrentNode(null);
433
- setCurrentNodeRendering(false);
434
- setSelectedIds([]);
435
- setNodeEnd(false);
436
- hasHighlight.current = false;
437
- nodeDraftRender.current = false;
438
- conclusionRender.current = false;
439
- window.localStorage.setItem('nodeRes', '');
440
- };
441
-
442
- const formatData = (data: any) => {
443
- try {
444
- setIsWaiting(false);
445
- const obj = JSON.parse(data);
446
- if (!obj.current_node && obj.response.state === 0) {
447
- console.log('chat is over end-------');
448
- setChatIsOver(true);
449
- return;
450
- }
451
- if (!obj.current_node && obj.response.state === 9) {
452
- setShowRight(false);
453
- setIsEnd(true);
454
- const replaced = replaceStr(obj.response.response);
455
- setResponse(replaced);
456
- return;
457
- }
458
- if (!obj.current_node && obj.response.state === 1 && !currentNode) {
459
- // 有thought,没有node
460
- setDraftEnd(false);
461
- setDraft(obj.response.response);
462
- }
463
- if (!obj.current_node && (obj.response.state !== 1 || obj.response.state !== 0 || obj.response.state !== 9)) {
464
- // 有thought,没有node, 不用处理渲染
465
- //console.log('loading-------------', obj);
466
- setDraftEnd(true);
467
- setIsWaiting(true);
468
- }
469
- if (obj.current_node && obj.response.state === 3) {
470
- setNodeName(obj.current_node);
471
- // 有node
472
- setObj(obj);
473
- const newAdjList = obj.response?.adjacency_list;
474
- if (newAdjList?.length > 0) {
475
- setAdjList(newAdjList);
476
- }
477
- }
478
- } catch (err) {
479
- console.log('format error-----', err);
480
- }
481
- };
482
-
483
- const startEventSource = () => {
484
- if (!chatIsOver) {
485
- message.warning('有对话进行中!');
486
- return;
487
- }
488
- setQuestion(stashQuestion);
489
- setChatIsOver(false);
490
- const postData = {
491
- inputs: [
492
- {
493
- role: 'user',
494
- content: stashQuestion
495
- }
496
- ]
497
- }
498
- const ctrl = new AbortController();
499
- eventSource = fetchEventSource(GET_SSE_DATA, {
500
- method: 'POST',
501
- headers: {
502
- 'Content-Type': 'application/json',
503
- },
504
- body: JSON.stringify(postData),
505
- onmessage(ev) {
506
- formatData(ev.data);
507
- },
508
- onerror(err) {
509
- console.log('sse error------', err);
510
- },
511
- // signal: ctrl.signal,
512
- });
513
- };
514
-
515
- const abortEventSource = () => {
516
- if (eventSource) {
517
- eventSource.close(); // 或使用其他方法关闭连接,具体取决于库的API
518
- eventSource = null;
519
- console.log('EventSource connection aborted due to timeout.');
520
- message.error('连接中断,2s后即将刷新页面---');
521
- setTimeout(() => {
522
- location.reload();
523
- }, 2000);
524
- }
525
- };
526
-
527
- return <div className={styles.mainPage} style={!showRight ? { maxWidth: '1000px' } : {}}>
528
- <div className={styles.chatContent}>
529
- <div className={styles.top} id="chatArea">
530
- <div id="messageWindowId">
531
- {
532
- question && <div className={styles.question}>
533
- <span>{question}</span>
534
- </div>
535
- }
536
- {
537
- (draft || response || renderData?.length > 0) &&
538
- <div className={styles.answer}>
539
- {
540
- renderData?.length > 0 ? <div className={styles.inner}>
541
- <div className={styles.mapArea}>
542
- <ul className={styles.mindmap} id="mindMap" style={isEnd ? { width: mapWidth, overflow: "hidden" } : {}}>
543
- {renderData.map((item: any) => (
544
- <MindMapItem key={item.name} item={item} isEnd={isEnd} />
545
- ))}
546
- {showEndNode &&
547
- <div className={styles.end} style={generateEndStyle()}>
548
- <div className={styles.node}>
549
- <article>最终回复</article>
550
- </div>
551
- </div>
552
- }
553
- </ul>
554
- </div>
555
- </div> : <></>
556
- }
557
- {
558
- !response && <div className={styles.draft}>
559
- {/* {!draftEnd && draft && <div className={styles.loading}>
560
- <div></div>
561
- <div></div>
562
- <div></div>
563
- </div>} */}
564
- <ReactMarkdown rehypePlugins={[rehypeRaw]}>{replaceStr(draft)}</ReactMarkdown>
565
- </div>
566
- }
567
- {response && <div className={styles.response}>
568
- <ReactMarkdown rehypePlugins={[rehypeRaw]}>{response}</ReactMarkdown>
569
- </div>}
570
- </div>
571
- }
572
- </div>
573
- </div>
574
- <div className={styles.sendArea}>
575
- <Input type="text" placeholder='说点什么吧~ Shift+Enter 换行 ; Enter 发送' onChange={(e) => { setStashQuestion(e.target.value) }}
576
- onPressEnter={startEventSource} />
577
- <button onClick={startEventSource}>
578
- <img src={SendIcon} />
579
- 发送
580
- </button>
581
- </div>
582
- <div className={styles.notice}>如果想要更丝滑的体验,请在本地搭建-<a href='https://github.com/InternLM/MindSearch' target='_blank'>MindSearch <IconFont type='icon-GithubFilled' /></a></div>
583
- </div>
584
- {showRight && <div className={styles.progressContent}>
585
- {
586
- currentNode && <>
587
- <div className={styles.toggleIcon} onClick={toggleRight}>
588
- <Tooltip placement="top" title="收起">
589
- <img src={PackIcon} />
590
- </Tooltip></div>
591
- <div className={styles.titleNode}>{currentNode?.content || currentNode?.node}</div>
592
- {
593
- currentNode?.actions?.length ? <>
594
- {
595
- currentNode.actions.map((item: any, idx: number) => (
596
- currentStep >= idx && <div className={classNames(
597
- styles.steps,
598
- item.type === "BingBrowser.search" ? styles.thinking : styles.select
599
- )} key={`step-${idx}`}>
600
- <div className={styles.title}>
601
- <i></i>{item.type === "BingBrowser.search" ? "思考" : item.type === "BingBrowser.select" ? "信息来源" : "信息整合"}
602
- <div className={styles.open} onClick={() => { toggleCard(idx) }}>
603
- <IconFont type={collapseInfo[idx] ? "icon-shouqi" : "icon-xiangxiazhankai"} />
604
- </div>
605
- </div>
606
- <div className={classNames(
607
- styles.con,
608
- !collapseInfo[idx] ? styles.collapsed : ""
609
- )}>
610
- {
611
- item.type === "BingBrowser.search" && <div className={styles.thought}>
612
- <ReactMarkdown rehypePlugins={[rehypeRaw]}>{progress1}</ReactMarkdown>
613
- </div>
614
- }
615
- {
616
- item.type === "BingBrowser.search" && query.length > 0 && <div className={styles.query}>
617
- <div className={styles.subTitle}><IconFont type="icon-SearchOutlined" />搜索关键词</div>
618
- {
619
- query.map((item, index) => (<div key={`query-item-${item}`} className={classNames(styles.queryItem, styles.fadeIn)}>
620
- {item}
621
- </div>))
622
- }
623
- </div>
624
- }
625
- {
626
- currentStep === idx && searchList.length > 0 && <div className={styles.searchList}>
627
- {item.type === "BingBrowser.search" && <div className={styles.subTitle}><IconFont type="icon-DocOutlined" />信息来源</div>}
628
- {
629
- item.type === "BingBrowser.select" && <div className={styles.thought}>
630
- <ReactMarkdown rehypePlugins={[rehypeRaw]}>{progress2}</ReactMarkdown>
631
- </div>
632
- }
633
- <div className={styles.scrollCon} style={(searchList.length > 5 && currentStep === 0) ? { height: '300px' } : {}}>
634
-
635
- <div className={styles.inner} style={(searchList.length > 5 && currentStep === 0) ? { position: 'absolute', bottom: 0, left: 0 } : {}}>
636
-
637
- {
638
- searchList.map((item: any, num: number) => (
639
- <div className={classNames(
640
- styles.searchItem,
641
- item.highLight ? styles.highLight : ""
642
- )} key={`search-item-${item.url}-${idx}`}>
643
- <p className={styles.summ}>{item.id}. {item?.title}</p>
644
- <p className={styles.url}>{item?.url}</p>
645
- </div>
646
- ))
647
- }
648
- </div>
649
- </div>
650
- </div>
651
- }
652
- </div>
653
- </div>
654
- ))
655
- }
656
- </> : <></>
657
- }
658
- </>
659
- }
660
- {
661
- conclusion && <div className={styles.steps}>
662
- <div className={styles.title}>
663
- <i></i>信息整合
664
- </div>
665
- <div className={styles.conclusion}>
666
- <ReactMarkdown rehypePlugins={[rehypeRaw]}>{conclusion}</ReactMarkdown>
667
- </div>
668
- </div>
669
- }
670
- {isWaiting && question && <div className={styles.loading99}></div>}
671
- </div>}
672
- {
673
- !showRight && <div className={styles.showRight} onClick={toggleRight}>
674
- <img src={ShowRightIcon} />
675
- </div>
676
- }
677
-
678
- </div>
679
- };
680
-
681
- export default RenderTest;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/pages/render/mindMapItem.tsx DELETED
@@ -1,39 +0,0 @@
1
- import styles from './index.module.less';
2
- import classNames from 'classnames';
3
-
4
- // 递归组件用于渲染mindMap中的节点
5
- const MindMapItem = ({ item, isEnd }: any) => {
6
- // 递归渲染子节点
7
- const renderChildren = () => {
8
- if (item.children && item.children.length > 0) {
9
- return (
10
- <ul className={item.children.length === 1 ? styles.onlyone : ''}>
11
- {item.children.map((child: any) => (
12
- <MindMapItem key={child.name} item={child} isEnd={isEnd} />
13
- ))}
14
- </ul>
15
- );
16
- }
17
- return null;
18
- };
19
-
20
- return (
21
- <li>
22
- <article className={
23
- classNames(
24
- item.state === 1 ? styles.loading : item.state === 2 ? styles.disabled : item.state === 3 ? styles.finished : "",
25
- item.id === 0 ? styles.init : ''
26
- )}>
27
- <span>{item.name}</span>
28
- {item.state === 1 && <div className={styles.looping}></div>}
29
- {item.id !== 0 && <div className={styles.finishDot}></div>}
30
- </article>
31
- {item.children.length > 0 && renderChildren()}
32
- {
33
- isEnd && item.children?.length === 0 && <div className={classNames(styles.endLine, "endline")}></div>
34
- }
35
- </li>
36
- );
37
- };
38
-
39
- export default MindMapItem;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/routes/routes.tsx DELETED
@@ -1,38 +0,0 @@
1
- import RenderTest from "@/pages/render";
2
-
3
- import { ReactElement } from "react";
4
- import { Navigate, useRoutes } from "react-router-dom";
5
-
6
- interface RouteItem {
7
- path: string;
8
- needLogin?: boolean;
9
- element: ReactElement;
10
- }
11
-
12
- const routes: RouteItem[] = [
13
- {
14
- path: "/",
15
- needLogin: false,
16
- element: <RenderTest />,
17
- },
18
- {
19
- path: "*",
20
- element: <Navigate to="/" />,
21
- },
22
- ];
23
-
24
- const WrapperRoutes = () => {
25
- return useRoutes(
26
- routes.map((item: RouteItem) => {
27
- if (item.needLogin) {
28
- return {
29
- ...item,
30
- element: <></>,
31
- };
32
- }
33
- return item;
34
- }),
35
- );
36
- };
37
-
38
- export default WrapperRoutes;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/utils/tools.ts DELETED
@@ -1,24 +0,0 @@
1
- export const getQueryString = (search: string, name: string) => {
2
- if (!search) return "";
3
- const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
4
- const result = search.substring(1).match(reg);
5
- if (result != null) return result[2];
6
- return "";
7
- };
8
-
9
- export const isInWhiteList = (url: string = "", list: string[] = []) => {
10
- const baseUrl = url.split("?")[0];
11
- for (let whiteApi of list) {
12
- if (baseUrl.endsWith(whiteApi)) {
13
- return true;
14
- }
15
- }
16
- return false;
17
- };
18
-
19
- export const replaceStr = (str: string) => {
20
- return str.replace(/\[\[(\d+)\]\]/g, (match: any, number: any) => {
21
- // 创建一个带有class为'fnn2'的span元素,并将数字作为文本内容
22
- return `<i class='f'>${number}</i>`;
23
- });
24
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/src/vite-env.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- interface ImportMetaEnv {
4
- readonly VITE_SSO_URL: string;
5
- }
6
-
7
- interface ImportMeta {
8
- readonly env: ImportMetaEnv;
9
- }
 
 
 
 
 
 
 
 
 
 
frontend/React/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES5",
4
- "useDefineForClassFields": true,
5
- "lib": ["DOM", "DOM.Iterable", "ESNext"],
6
- "allowJs": false,
7
- "skipLibCheck": true,
8
- "esModuleInterop": false,
9
- "allowSyntheticDefaultImports": true,
10
- "strict": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "module": "ESNext",
13
- "moduleResolution": "Node",
14
- "resolveJsonModule": true,
15
- "isolatedModules": true,
16
- "noEmit": true,
17
- "jsx": "react-jsx",
18
- "baseUrl": "./",
19
- "paths": {
20
- "@/*": ["src/*"]
21
- }
22
- },
23
- "include": ["src"]
24
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/vite.config.ts DELETED
@@ -1,62 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import react from "@vitejs/plugin-react";
3
- import path from "path";
4
- import legacy from "@vitejs/plugin-legacy";
5
-
6
- // https://vitejs.dev/config/
7
- export default defineConfig({
8
- plugins: [
9
- react({
10
- babel: {
11
- plugins: [
12
- "@babel/plugin-proposal-optional-chaining", // 兼容老版本浏览器的语法解译
13
- ],
14
- },
15
- }),
16
- legacy({
17
- targets: ["defaults", "ie >= 11", "chrome >= 52"], //需要兼容的目标列表,可以设置多个
18
- additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
19
- renderLegacyChunks: true,
20
- polyfills: [
21
- "es.symbol",
22
- "es.array.filter",
23
- "es.promise",
24
- "es.promise.finally",
25
- "es/map",
26
- "es/set",
27
- "es.array.for-each",
28
- "es.object.define-properties",
29
- "es.object.define-property",
30
- "es.object.get-own-property-descriptor",
31
- "es.object.get-own-property-descriptors",
32
- "es.object.keys",
33
- "es.object.to-string",
34
- "web.dom-collections.for-each",
35
- "esnext.global-this",
36
- "esnext.string.match-all",
37
- ],
38
- }),
39
- ],
40
- build: {
41
- target: "es5",
42
- },
43
- resolve: {
44
- alias: {
45
- "@": path.resolve(__dirname, "src"),
46
- },
47
- },
48
- css: {
49
- modules: {
50
- localsConvention: "camelCase",
51
- },
52
- },
53
- server: {
54
- port: 7860,
55
- proxy: {
56
- // "/solve": {
57
- // target: "...",
58
- // changeOrigin: true,
59
- // },
60
- },
61
- },
62
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/React/windows-.png DELETED
Binary file (14 kB)
 
frontend/mindsearch_gradio.py DELETED
@@ -1,142 +0,0 @@
1
- import json
2
-
3
- import gradio as gr
4
- import requests
5
- from lagent.schema import AgentStatusCode
6
-
7
- PLANNER_HISTORY = []
8
- SEARCHER_HISTORY = []
9
-
10
-
11
- def rst_mem(history_planner: list, history_searcher: list):
12
- '''
13
- Reset the chatbot memory.
14
- '''
15
- history_planner = []
16
- history_searcher = []
17
- if PLANNER_HISTORY:
18
- PLANNER_HISTORY.clear()
19
- return history_planner, history_searcher
20
-
21
-
22
- def format_response(gr_history, agent_return):
23
- if agent_return['state'] in [
24
- AgentStatusCode.STREAM_ING, AgentStatusCode.ANSWER_ING
25
- ]:
26
- gr_history[-1][1] = agent_return['response']
27
- elif agent_return['state'] == AgentStatusCode.PLUGIN_START:
28
- thought = gr_history[-1][1].split('```')[0]
29
- if agent_return['response'].startswith('```'):
30
- gr_history[-1][1] = thought + '\n' + agent_return['response']
31
- elif agent_return['state'] == AgentStatusCode.PLUGIN_END:
32
- thought = gr_history[-1][1].split('```')[0]
33
- if isinstance(agent_return['response'], dict):
34
- gr_history[-1][
35
- 1] = thought + '\n' + f'```json\n{json.dumps(agent_return["response"], ensure_ascii=False, indent=4)}\n```' # noqa: E501
36
- elif agent_return['state'] == AgentStatusCode.PLUGIN_RETURN:
37
- assert agent_return['inner_steps'][-1]['role'] == 'environment'
38
- item = agent_return['inner_steps'][-1]
39
- gr_history.append([
40
- None,
41
- f"```json\n{json.dumps(item['content'], ensure_ascii=False, indent=4)}\n```"
42
- ])
43
- gr_history.append([None, ''])
44
- return
45
-
46
-
47
- def predict(history_planner, history_searcher):
48
-
49
- def streaming(raw_response):
50
- for chunk in raw_response.iter_lines(chunk_size=8192,
51
- decode_unicode=False,
52
- delimiter=b'\n'):
53
- if chunk:
54
- decoded = chunk.decode('utf-8')
55
- if decoded == '\r':
56
- continue
57
- if decoded[:6] == 'data: ':
58
- decoded = decoded[6:]
59
- elif decoded.startswith(': ping - '):
60
- continue
61
- response = json.loads(decoded)
62
- yield (response['response'], response['current_node'])
63
-
64
- global PLANNER_HISTORY
65
- PLANNER_HISTORY.append(dict(role='user', content=history_planner[-1][0]))
66
- new_search_turn = True
67
-
68
- url = 'http://localhost:8002/solve'
69
- headers = {'Content-Type': 'application/json'}
70
- data = {'inputs': PLANNER_HISTORY}
71
- raw_response = requests.post(url,
72
- headers=headers,
73
- data=json.dumps(data),
74
- timeout=20,
75
- stream=True)
76
-
77
- for resp in streaming(raw_response):
78
- agent_return, node_name = resp
79
- if node_name:
80
- if node_name in ['root', 'response']:
81
- continue
82
- agent_return = agent_return['nodes'][node_name]['detail']
83
- if new_search_turn:
84
- history_searcher.append([agent_return['content'], ''])
85
- new_search_turn = False
86
- format_response(history_searcher, agent_return)
87
- if agent_return['state'] == AgentStatusCode.END:
88
- new_search_turn = True
89
- yield history_planner, history_searcher
90
- else:
91
- new_search_turn = True
92
- format_response(history_planner, agent_return)
93
- if agent_return['state'] == AgentStatusCode.END:
94
- PLANNER_HISTORY = agent_return['inner_steps']
95
- yield history_planner, history_searcher
96
- return history_planner, history_searcher
97
-
98
-
99
- with gr.Blocks() as demo:
100
- gr.HTML("""<h1 align="center">WebAgent Gradio Simple Demo</h1>""")
101
- with gr.Row():
102
- with gr.Column(scale=10):
103
- with gr.Row():
104
- with gr.Column():
105
- planner = gr.Chatbot(label='planner',
106
- height=700,
107
- show_label=True,
108
- show_copy_button=True,
109
- bubble_full_width=False,
110
- render_markdown=True)
111
- with gr.Column():
112
- searcher = gr.Chatbot(label='searcher',
113
- height=700,
114
- show_label=True,
115
- show_copy_button=True,
116
- bubble_full_width=False,
117
- render_markdown=True)
118
- with gr.Row():
119
- user_input = gr.Textbox(show_label=False,
120
- placeholder='inputs...',
121
- lines=5,
122
- container=False)
123
- with gr.Row():
124
- with gr.Column(scale=2):
125
- submitBtn = gr.Button('Submit')
126
- with gr.Column(scale=1, min_width=20):
127
- emptyBtn = gr.Button('Clear History')
128
-
129
- def user(query, history):
130
- return '', history + [[query, '']]
131
-
132
- submitBtn.click(user, [user_input, planner], [user_input, planner],
133
- queue=False).then(predict, [planner, searcher],
134
- [planner, searcher])
135
- emptyBtn.click(rst_mem, [planner, searcher], [planner, searcher],
136
- queue=False)
137
-
138
- demo.queue()
139
- demo.launch(server_name='127.0.0.1',
140
- server_port=7882,
141
- inbrowser=True,
142
- share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend/mindsearch_streamlit.py DELETED
@@ -1,319 +0,0 @@
1
- import json
2
- import tempfile
3
-
4
- import requests
5
- import streamlit as st
6
- from lagent.schema import AgentStatusCode
7
- from pyvis.network import Network
8
-
9
-
10
- # Function to create the network graph
11
- def create_network_graph(nodes, adjacency_list):
12
- net = Network(height='500px',
13
- width='60%',
14
- bgcolor='white',
15
- font_color='black')
16
- for node_id, node_data in nodes.items():
17
- if node_id in ['root', 'response']:
18
- title = node_data.get('content', node_id)
19
- else:
20
- title = node_data['detail']['content']
21
- net.add_node(node_id,
22
- label=node_id,
23
- title=title,
24
- color='#FF5733',
25
- size=25)
26
- for node_id, neighbors in adjacency_list.items():
27
- for neighbor in neighbors:
28
- if neighbor['name'] in nodes:
29
- net.add_edge(node_id, neighbor['name'])
30
- net.show_buttons(filter_=['physics'])
31
- return net
32
-
33
-
34
- # Function to draw the graph and return the HTML file path
35
- def draw_graph(net):
36
- path = tempfile.mktemp(suffix='.html')
37
- net.save_graph(path)
38
- return path
39
-
40
-
41
- def streaming(raw_response):
42
- for chunk in raw_response.iter_lines(chunk_size=8192,
43
- decode_unicode=False,
44
- delimiter=b'\n'):
45
- if chunk:
46
- decoded = chunk.decode('utf-8')
47
- if decoded == '\r':
48
- continue
49
- if decoded[:6] == 'data: ':
50
- decoded = decoded[6:]
51
- elif decoded.startswith(': ping - '):
52
- continue
53
- response = json.loads(decoded)
54
- yield (response['response'], response['current_node'])
55
-
56
-
57
- # Initialize Streamlit session state
58
- if 'queries' not in st.session_state:
59
- st.session_state['queries'] = []
60
- st.session_state['responses'] = []
61
- st.session_state['graphs_html'] = []
62
- st.session_state['nodes_list'] = []
63
- st.session_state['adjacency_list_list'] = []
64
- st.session_state['history'] = []
65
- st.session_state['already_used_keys'] = list()
66
-
67
- # Set up page layout
68
- st.set_page_config(layout='wide')
69
- st.title('MindSearch-思索')
70
-
71
-
72
- # Function to update chat
73
- def update_chat(query):
74
- with st.chat_message('user'):
75
- st.write(query)
76
- if query not in st.session_state['queries']:
77
- # Mock data to simulate backend response
78
- # response, history, nodes, adjacency_list
79
- st.session_state['queries'].append(query)
80
- st.session_state['responses'].append([])
81
- history = None
82
- # 暂不支持多轮
83
- message = [dict(role='user', content=query)]
84
-
85
- url = 'http://localhost:8002/solve'
86
- headers = {'Content-Type': 'application/json'}
87
- data = {'inputs': message}
88
- raw_response = requests.post(url,
89
- headers=headers,
90
- data=json.dumps(data),
91
- timeout=20,
92
- stream=True)
93
-
94
- for resp in streaming(raw_response):
95
- agent_return, node_name = resp
96
- if node_name and node_name in ['root', 'response']:
97
- continue
98
- nodes = agent_return['nodes']
99
- adjacency_list = agent_return['adj']
100
- response = agent_return['response']
101
- history = agent_return['inner_steps']
102
- if nodes:
103
- net = create_network_graph(nodes, adjacency_list)
104
- graph_html_path = draw_graph(net)
105
- with open(graph_html_path, encoding='utf-8') as f:
106
- graph_html = f.read()
107
- else:
108
- graph_html = None
109
- if 'graph_placeholder' not in st.session_state:
110
- st.session_state['graph_placeholder'] = st.empty()
111
- if 'expander_placeholder' not in st.session_state:
112
- st.session_state['expander_placeholder'] = st.empty()
113
- if graph_html:
114
- with st.session_state['expander_placeholder'].expander(
115
- 'Show Graph', expanded=False):
116
- st.session_state['graph_placeholder']._html(graph_html,
117
- height=500)
118
- if 'container_placeholder' not in st.session_state:
119
- st.session_state['container_placeholder'] = st.empty()
120
- with st.session_state['container_placeholder'].container():
121
- if 'columns_placeholder' not in st.session_state:
122
- st.session_state['columns_placeholder'] = st.empty()
123
- col1, col2 = st.session_state['columns_placeholder'].columns(
124
- [2, 1])
125
- with col1:
126
- if 'planner_placeholder' not in st.session_state:
127
- st.session_state['planner_placeholder'] = st.empty()
128
- if 'session_info_temp' not in st.session_state:
129
- st.session_state['session_info_temp'] = ''
130
- if not node_name:
131
- if agent_return['state'] in [
132
- AgentStatusCode.STREAM_ING,
133
- AgentStatusCode.ANSWER_ING
134
- ]:
135
- st.session_state['session_info_temp'] = response
136
- elif agent_return[
137
- 'state'] == AgentStatusCode.PLUGIN_START:
138
- thought = st.session_state[
139
- 'session_info_temp'].split('```')[0]
140
- if agent_return['response'].startswith('```'):
141
- st.session_state[
142
- 'session_info_temp'] = thought + '\n' + response
143
- elif agent_return[
144
- 'state'] == AgentStatusCode.PLUGIN_RETURN:
145
- assert agent_return['inner_steps'][-1][
146
- 'role'] == 'environment'
147
- st.session_state[
148
- 'session_info_temp'] += '\n' + agent_return[
149
- 'inner_steps'][-1]['content']
150
- st.session_state['planner_placeholder'].markdown(
151
- st.session_state['session_info_temp'])
152
- if agent_return[
153
- 'state'] == AgentStatusCode.PLUGIN_RETURN:
154
- st.session_state['responses'][-1].append(
155
- st.session_state['session_info_temp'])
156
- st.session_state['session_info_temp'] = ''
157
- else:
158
- st.session_state['planner_placeholder'].markdown(
159
- st.session_state['responses'][-1][-1] if
160
- not st.session_state['session_info_temp'] else st.
161
- session_state['session_info_temp'])
162
- with col2:
163
- if 'selectbox_placeholder' not in st.session_state:
164
- st.session_state['selectbox_placeholder'] = st.empty()
165
- if 'searcher_placeholder' not in st.session_state:
166
- st.session_state['searcher_placeholder'] = st.empty()
167
- # st.session_state['searcher_placeholder'].markdown('')
168
- if node_name:
169
- selected_node_key = f"selected_node_{len(st.session_state['queries'])}_{node_name}"
170
- if selected_node_key not in st.session_state:
171
- st.session_state[selected_node_key] = node_name
172
- if selected_node_key not in st.session_state[
173
- 'already_used_keys']:
174
- selected_node = st.session_state[
175
- 'selectbox_placeholder'].selectbox(
176
- 'Select a node:',
177
- list(nodes.keys()),
178
- key=f'key_{selected_node_key}',
179
- index=list(nodes.keys()).index(node_name))
180
- st.session_state['already_used_keys'].append(
181
- selected_node_key)
182
- else:
183
- selected_node = node_name
184
- st.session_state[selected_node_key] = selected_node
185
- if selected_node in nodes:
186
- node = nodes[selected_node]
187
- agent_return = node['detail']
188
- node_info_key = f'{selected_node}_info'
189
- if 'node_info_temp' not in st.session_state:
190
- st.session_state[
191
- 'node_info_temp'] = f'### {agent_return["content"]}'
192
- if node_info_key not in st.session_state:
193
- st.session_state[node_info_key] = []
194
- if agent_return['state'] in [
195
- AgentStatusCode.STREAM_ING,
196
- AgentStatusCode.ANSWER_ING
197
- ]:
198
- st.session_state[
199
- 'node_info_temp'] = agent_return[
200
- 'response']
201
- elif agent_return[
202
- 'state'] == AgentStatusCode.PLUGIN_START:
203
- thought = st.session_state[
204
- 'node_info_temp'].split('```')[0]
205
- if agent_return['response'].startswith('```'):
206
- st.session_state[
207
- 'node_info_temp'] = thought + '\n' + agent_return[
208
- 'response']
209
- elif agent_return[
210
- 'state'] == AgentStatusCode.PLUGIN_END:
211
- thought = st.session_state[
212
- 'node_info_temp'].split('```')[0]
213
- if isinstance(agent_return['response'], dict):
214
- st.session_state[
215
- 'node_info_temp'] = thought + '\n' + f'```json\n{json.dumps(agent_return["response"], ensure_ascii=False, indent=4)}\n```' # noqa: E501
216
- elif agent_return[
217
- 'state'] == AgentStatusCode.PLUGIN_RETURN:
218
- assert agent_return['inner_steps'][-1][
219
- 'role'] == 'environment'
220
- st.session_state[node_info_key].append(
221
- ('thought',
222
- st.session_state['node_info_temp']))
223
- st.session_state[node_info_key].append(
224
- ('observation',
225
- agent_return['inner_steps'][-1]['content']
226
- ))
227
- st.session_state['searcher_placeholder'].markdown(
228
- st.session_state['node_info_temp'])
229
- if agent_return['state'] == AgentStatusCode.END:
230
- st.session_state[node_info_key].append(
231
- ('answer',
232
- st.session_state['node_info_temp']))
233
- st.session_state['node_info_temp'] = ''
234
- if st.session_state['session_info_temp']:
235
- st.session_state['responses'][-1].append(
236
- st.session_state['session_info_temp'])
237
- st.session_state['session_info_temp'] = ''
238
- # st.session_state['responses'][-1] = '\n'.join(st.session_state['responses'][-1])
239
- st.session_state['graphs_html'].append(graph_html)
240
- st.session_state['nodes_list'].append(nodes)
241
- st.session_state['adjacency_list_list'].append(adjacency_list)
242
- st.session_state['history'] = history
243
-
244
-
245
- def display_chat_history():
246
- for i, query in enumerate(st.session_state['queries'][-1:]):
247
- # with st.chat_message('assistant'):
248
- if st.session_state['graphs_html'][i]:
249
- with st.session_state['expander_placeholder'].expander(
250
- 'Show Graph', expanded=False):
251
- st.session_state['graph_placeholder']._html(
252
- st.session_state['graphs_html'][i], height=500)
253
- with st.session_state['container_placeholder'].container():
254
- col1, col2 = st.session_state['columns_placeholder'].columns(
255
- [2, 1])
256
- with col1:
257
- st.session_state['planner_placeholder'].markdown(
258
- st.session_state['responses'][-1][-1])
259
- with col2:
260
- selected_node_key = st.session_state['already_used_keys'][
261
- -1]
262
- st.session_state['selectbox_placeholder'] = st.empty()
263
- selected_node = st.session_state[
264
- 'selectbox_placeholder'].selectbox(
265
- 'Select a node:',
266
- list(st.session_state['nodes_list'][i].keys()),
267
- key=f'replay_key_{i}',
268
- index=list(st.session_state['nodes_list'][i].keys(
269
- )).index(st.session_state[selected_node_key]))
270
- st.session_state[selected_node_key] = selected_node
271
- if selected_node not in [
272
- 'root', 'response'
273
- ] and selected_node in st.session_state['nodes_list'][i]:
274
- node_info_key = f'{selected_node}_info'
275
- for item in st.session_state[node_info_key]:
276
- if item[0] in ['thought', 'answer']:
277
- st.session_state[
278
- 'searcher_placeholder'] = st.empty()
279
- st.session_state[
280
- 'searcher_placeholder'].markdown(item[1])
281
- elif item[0] == 'observation':
282
- st.session_state[
283
- 'observation_expander'] = st.empty()
284
- with st.session_state[
285
- 'observation_expander'].expander(
286
- 'Results'):
287
- st.write(item[1])
288
- # st.session_state['searcher_placeholder'].markdown(st.session_state[node_info_key])
289
-
290
-
291
- def clean_history():
292
- st.session_state['queries'] = []
293
- st.session_state['responses'] = []
294
- st.session_state['graphs_html'] = []
295
- st.session_state['nodes_list'] = []
296
- st.session_state['adjacency_list_list'] = []
297
- st.session_state['history'] = []
298
- st.session_state['already_used_keys'] = list()
299
- for k in st.session_state:
300
- if k.endswith('placeholder') or k.endswith('_info'):
301
- del st.session_state[k]
302
-
303
-
304
- # Main function to run the Streamlit app
305
- def main():
306
- st.sidebar.title('Model Control')
307
- col1, col2 = st.columns([4, 1])
308
- with col1:
309
- user_input = st.chat_input('Enter your query:')
310
- with col2:
311
- if st.button('Clear History'):
312
- clean_history()
313
- if user_input:
314
- update_chat(user_input)
315
- display_chat_history()
316
-
317
-
318
- if __name__ == '__main__':
319
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mindsearch/__pycache__/app.cpython-310.pyc DELETED
Binary file (4.05 kB)
 
mindsearch/agent/__init__.py DELETED
@@ -1,66 +0,0 @@
1
- import os
2
- from datetime import datetime
3
-
4
- from lagent.actions import ActionExecutor, BingBrowser
5
-
6
- import os
7
-
8
- #BING_API_KEY = os.getenv['BING_API_KEY']
9
-
10
- import mindsearch.agent.models as llm_factory
11
- from mindsearch.agent.mindsearch_agent import (MindSearchAgent,
12
- MindSearchProtocol)
13
- from mindsearch.agent.mindsearch_prompt import (
14
- FINAL_RESPONSE_CN, FINAL_RESPONSE_EN, GRAPH_PROMPT_CN, GRAPH_PROMPT_EN,
15
- fewshot_example_cn, fewshot_example_en, graph_fewshot_example_cn,
16
- graph_fewshot_example_en, searcher_context_template_cn,
17
- searcher_context_template_en, searcher_input_template_cn,
18
- searcher_input_template_en, searcher_system_prompt_cn,
19
- searcher_system_prompt_en)
20
-
21
- LLM = {}
22
-
23
-
24
- def init_agent(lang='cn', model_format='internlm_server'):
25
- llm = LLM.get(model_format, None)
26
- if llm is None:
27
- llm_cfg = getattr(llm_factory, model_format)
28
- if llm_cfg is None:
29
- raise NotImplementedError
30
- llm_cfg = llm_cfg.copy()
31
- llm = llm_cfg.pop('type')(**llm_cfg)
32
- LLM[model_format] = llm
33
-
34
- interpreter_prompt = GRAPH_PROMPT_CN if lang == 'cn' else GRAPH_PROMPT_EN
35
- plugin_prompt = searcher_system_prompt_cn if lang == 'cn' else searcher_system_prompt_en
36
- if model_format == 'gpt4':
37
- interpreter_prompt += graph_fewshot_example_cn if lang == 'cn' else graph_fewshot_example_en
38
- plugin_prompt += fewshot_example_cn if lang == 'cn' else fewshot_example_en
39
-
40
- agent = MindSearchAgent(
41
- llm=llm,
42
- protocol=MindSearchProtocol(meta_prompt=datetime.now().strftime(
43
- 'The current date is %Y-%m-%d.'),
44
- interpreter_prompt=interpreter_prompt,
45
- response_prompt=FINAL_RESPONSE_CN
46
- if lang == 'cn' else FINAL_RESPONSE_EN),
47
-
48
-
49
- searcher_cfg=dict(
50
- llm=llm,
51
- plugin_executor=ActionExecutor(
52
- BingBrowser(searcher_type='BingSearch',
53
- topk=6,
54
- api_key=os.environ.get('BING_API_KEY',
55
- 'YOUR BING API'))),
56
- protocol=MindSearchProtocol(
57
- meta_prompt=datetime.now().strftime(
58
- 'The current date is %Y-%m-%d.'),
59
- plugin_prompt=plugin_prompt,
60
- ),
61
- template=dict(input=searcher_input_template_cn
62
- if lang == 'cn' else searcher_input_template_en,
63
- context=searcher_context_template_cn
64
- if lang == 'cn' else searcher_context_template_en)),
65
- max_turn=10)
66
- return agent
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mindsearch/agent/mindsearch_agent.py DELETED
@@ -1,408 +0,0 @@
1
- import json
2
- import logging
3
- import queue
4
- import random
5
- import re
6
- import threading
7
- import uuid
8
- from collections import defaultdict
9
- from concurrent.futures import ThreadPoolExecutor, as_completed
10
- from copy import deepcopy
11
- from dataclasses import asdict
12
- from typing import Dict, List, Optional
13
-
14
- from lagent.actions import ActionExecutor
15
- from lagent.agents import BaseAgent, Internlm2Agent
16
- from lagent.agents.internlm2_agent import Internlm2Protocol
17
- from lagent.schema import AgentReturn, AgentStatusCode, ModelStatusCode
18
- from termcolor import colored
19
-
20
- # 初始化日志记录
21
- logging.basicConfig(level=logging.INFO)
22
- logger = logging.getLogger(__name__)
23
-
24
-
25
- class SearcherAgent(Internlm2Agent):
26
-
27
- def __init__(self, template='{query}', **kwargs) -> None:
28
- super().__init__(**kwargs)
29
- self.template = template
30
-
31
- def stream_chat(self,
32
- question: str,
33
- root_question: str = None,
34
- parent_response: List[dict] = None,
35
- **kwargs) -> AgentReturn:
36
- message = self.template['input'].format(question=question,
37
- topic=root_question)
38
- if parent_response:
39
- if 'context' in self.template:
40
- parent_response = [
41
- self.template['context'].format(**item)
42
- for item in parent_response
43
- ]
44
- message = '\n'.join(parent_response + [message])
45
- print(colored(f'current query: {message}', 'green'))
46
- for agent_return in super().stream_chat(message,
47
- session_id=random.randint(
48
- 0, 999999),
49
- **kwargs):
50
- agent_return.type = 'searcher'
51
- agent_return.content = question
52
- yield deepcopy(agent_return)
53
-
54
-
55
- class MindSearchProtocol(Internlm2Protocol):
56
-
57
- def __init__(
58
- self,
59
- meta_prompt: str = None,
60
- interpreter_prompt: str = None,
61
- plugin_prompt: str = None,
62
- few_shot: Optional[List] = None,
63
- response_prompt: str = None,
64
- language: Dict = dict(
65
- begin='',
66
- end='',
67
- belong='assistant',
68
- ),
69
- tool: Dict = dict(
70
- begin='{start_token}{name}\n',
71
- start_token='<|action_start|>',
72
- name_map=dict(plugin='<|plugin|>', interpreter='<|interpreter|>'),
73
- belong='assistant',
74
- end='<|action_end|>\n',
75
- ),
76
- execute: Dict = dict(role='execute',
77
- begin='',
78
- end='',
79
- fallback_role='environment'),
80
- ) -> None:
81
- self.response_prompt = response_prompt
82
- super().__init__(meta_prompt=meta_prompt,
83
- interpreter_prompt=interpreter_prompt,
84
- plugin_prompt=plugin_prompt,
85
- few_shot=few_shot,
86
- language=language,
87
- tool=tool,
88
- execute=execute)
89
-
90
- def format(self,
91
- inner_step: List[Dict],
92
- plugin_executor: ActionExecutor = None,
93
- **kwargs) -> list:
94
- formatted = []
95
- if self.meta_prompt:
96
- formatted.append(dict(role='system', content=self.meta_prompt))
97
- if self.plugin_prompt:
98
- plugin_prompt = self.plugin_prompt.format(tool_info=json.dumps(
99
- plugin_executor.get_actions_info(), ensure_ascii=False))
100
- formatted.append(
101
- dict(role='system', content=plugin_prompt, name='plugin'))
102
- if self.interpreter_prompt:
103
- formatted.append(
104
- dict(role='system',
105
- content=self.interpreter_prompt,
106
- name='interpreter'))
107
- if self.few_shot:
108
- for few_shot in self.few_shot:
109
- formatted += self.format_sub_role(few_shot)
110
- formatted += self.format_sub_role(inner_step)
111
- return formatted
112
-
113
-
114
- class WebSearchGraph:
115
- end_signal = 'end'
116
- searcher_cfg = dict()
117
-
118
- def __init__(self):
119
- self.nodes = {}
120
- self.adjacency_list = defaultdict(list)
121
- self.executor = ThreadPoolExecutor(max_workers=10)
122
- self.future_to_query = dict()
123
- self.searcher_resp_queue = queue.Queue()
124
-
125
- def add_root_node(self, node_content, node_name='root'):
126
- self.nodes[node_name] = dict(content=node_content, type='root')
127
- self.adjacency_list[node_name] = []
128
- self.searcher_resp_queue.put((node_name, self.nodes[node_name], []))
129
-
130
- def add_node(self, node_name, node_content):
131
- self.nodes[node_name] = dict(content=node_content, type='searcher')
132
- self.adjacency_list[node_name] = []
133
-
134
- def model_stream_thread():
135
- agent = SearcherAgent(**self.searcher_cfg)
136
- try:
137
- parent_nodes = []
138
- for start_node, adj in self.adjacency_list.items():
139
- for neighbor in adj:
140
- if node_name == neighbor[
141
- 'name'] and start_node in self.nodes and 'response' in self.nodes[
142
- start_node]:
143
- parent_nodes.append(self.nodes[start_node])
144
- parent_response = [
145
- dict(question=node['content'], answer=node['response'])
146
- for node in parent_nodes
147
- ]
148
- for answer in agent.stream_chat(
149
- node_content,
150
- self.nodes['root']['content'],
151
- parent_response=parent_response):
152
- self.searcher_resp_queue.put(
153
- deepcopy((node_name,
154
- dict(response=answer.response,
155
- detail=answer), [])))
156
- self.nodes[node_name]['response'] = answer.response
157
- self.nodes[node_name]['detail'] = answer
158
- except Exception as e:
159
- logger.exception(f'Error in model_stream_thread: {e}')
160
-
161
- self.future_to_query[self.executor.submit(
162
- model_stream_thread)] = f'{node_name}-{node_content}'
163
-
164
- def add_response_node(self, node_name='response'):
165
- self.nodes[node_name] = dict(type='end')
166
- self.searcher_resp_queue.put((node_name, self.nodes[node_name], []))
167
-
168
- def add_edge(self, start_node, end_node):
169
- self.adjacency_list[start_node].append(
170
- dict(id=str(uuid.uuid4()), name=end_node, state=2))
171
- self.searcher_resp_queue.put((start_node, self.nodes[start_node],
172
- self.adjacency_list[start_node]))
173
-
174
- def reset(self):
175
- self.nodes = {}
176
- self.adjacency_list = defaultdict(list)
177
-
178
- def node(self, node_name):
179
- return self.nodes[node_name].copy()
180
-
181
-
182
- class MindSearchAgent(BaseAgent):
183
-
184
- def __init__(self,
185
- llm,
186
- searcher_cfg,
187
- protocol=MindSearchProtocol(),
188
- max_turn=10):
189
- self.local_dict = {}
190
- self.ptr = 0
191
- self.llm = llm
192
- self.max_turn = max_turn
193
- WebSearchGraph.searcher_cfg = searcher_cfg
194
- super().__init__(llm=llm, action_executor=None, protocol=protocol)
195
-
196
- def stream_chat(self, message, **kwargs):
197
- if isinstance(message, str):
198
- message = [{'role': 'user', 'content': message}]
199
- elif isinstance(message, dict):
200
- message = [message]
201
- as_dict = kwargs.pop('as_dict', False)
202
- return_early = kwargs.pop('return_early', False)
203
- self.local_dict.clear()
204
- self.ptr = 0
205
- inner_history = message[:]
206
- agent_return = AgentReturn()
207
- agent_return.type = 'planner'
208
- agent_return.nodes = {}
209
- agent_return.adjacency_list = {}
210
- agent_return.inner_steps = deepcopy(inner_history)
211
- for _ in range(self.max_turn):
212
- prompt = self._protocol.format(inner_step=inner_history)
213
- for model_state, response, _ in self.llm.stream_chat(
214
- prompt, session_id=random.randint(0, 999999), **kwargs):
215
- if model_state.value < 0:
216
- agent_return.state = getattr(AgentStatusCode,
217
- model_state.name)
218
- yield deepcopy(agent_return)
219
- return
220
- response = response.replace('<|plugin|>', '<|interpreter|>')
221
- _, language, action = self._protocol.parse(response)
222
- if not language and not action:
223
- continue
224
- code = action['parameters']['command'] if action else ''
225
- agent_return.state = self._determine_agent_state(
226
- model_state, code, agent_return)
227
- agent_return.response = language if not code else code
228
-
229
- # if agent_return.state == AgentStatusCode.STREAM_ING:
230
- yield deepcopy(agent_return)
231
-
232
- inner_history.append({'role': 'language', 'content': language})
233
- print(colored(response, 'blue'))
234
-
235
- if code:
236
- yield from self._process_code(agent_return, inner_history,
237
- code, as_dict, return_early)
238
- else:
239
- agent_return.state = AgentStatusCode.END
240
- yield deepcopy(agent_return)
241
- return
242
-
243
- agent_return.state = AgentStatusCode.END
244
- yield deepcopy(agent_return)
245
-
246
- def _determine_agent_state(self, model_state, code, agent_return):
247
- if code:
248
- return (AgentStatusCode.PLUGIN_START if model_state
249
- == ModelStatusCode.END else AgentStatusCode.PLUGIN_START)
250
- return (AgentStatusCode.ANSWER_ING
251
- if agent_return.nodes and 'response' in agent_return.nodes else
252
- AgentStatusCode.STREAM_ING)
253
-
254
- def _process_code(self,
255
- agent_return,
256
- inner_history,
257
- code,
258
- as_dict=False,
259
- return_early=False):
260
- for node_name, node, adj in self.execute_code(
261
- code, return_early=return_early):
262
- if as_dict and 'detail' in node:
263
- node['detail'] = asdict(node['detail'])
264
- if not adj:
265
- agent_return.nodes[node_name] = node
266
- else:
267
- agent_return.adjacency_list[node_name] = adj
268
- # state 1进行中,2未开始,3已结束
269
- for start_node, neighbors in agent_return.adjacency_list.items():
270
- for neighbor in neighbors:
271
- if neighbor['name'] not in agent_return.nodes:
272
- state = 2
273
- elif 'detail' not in agent_return.nodes[neighbor['name']]:
274
- state = 2
275
- elif agent_return.nodes[neighbor['name']][
276
- 'detail'].state == AgentStatusCode.END:
277
- state = 3
278
- else:
279
- state = 1
280
- neighbor['state'] = state
281
- if not adj:
282
- yield deepcopy((agent_return, node_name))
283
- reference, references_url = self._generate_reference(
284
- agent_return, code, as_dict)
285
- inner_history.append({
286
- 'role': 'tool',
287
- 'content': code,
288
- 'name': 'plugin'
289
- })
290
- inner_history.append({
291
- 'role': 'environment',
292
- 'content': reference,
293
- 'name': 'plugin'
294
- })
295
- agent_return.inner_steps = deepcopy(inner_history)
296
- agent_return.state = AgentStatusCode.PLUGIN_RETURN
297
- agent_return.references.update(references_url)
298
- yield deepcopy(agent_return)
299
-
300
- def _generate_reference(self, agent_return, code, as_dict):
301
- node_list = [
302
- node.strip().strip('\"') for node in re.findall(
303
- r'graph\.node\("((?:[^"\\]|\\.)*?)"\)', code)
304
- ]
305
- if 'add_response_node' in code:
306
- return self._protocol.response_prompt, dict()
307
- references = []
308
- references_url = dict()
309
- for node_name in node_list:
310
- if as_dict:
311
- ref_results = agent_return.nodes[node_name]['detail'][
312
- 'actions'][0]['result'][0]['content']
313
- else:
314
- ref_results = agent_return.nodes[node_name]['detail'].actions[
315
- 0].result[0]['content']
316
- ref_results = json.loads(ref_results)
317
- ref2url = {idx: item['url'] for idx, item in ref_results.items()}
318
- ref = f"## {node_name}\n\n{agent_return.nodes[node_name]['response']}\n"
319
- updated_ref = re.sub(
320
- r'\[\[(\d+)\]\]',
321
- lambda match: f'[[{int(match.group(1)) + self.ptr}]]', ref)
322
- numbers = [int(n) for n in re.findall(r'\[\[(\d+)\]\]', ref)]
323
- if numbers:
324
- assert all(str(elem) in ref2url for elem in numbers)
325
- references_url.update({
326
- str(idx + self.ptr): ref2url[str(idx)]
327
- for idx in set(numbers)
328
- })
329
- self.ptr += max(numbers) + 1
330
- references.append(updated_ref)
331
- return '\n'.join(references), references_url
332
-
333
- def execute_code(self, command: str, return_early=False):
334
-
335
- def extract_code(text: str) -> str:
336
- text = re.sub(r'from ([\w.]+) import WebSearchGraph', '', text)
337
- triple_match = re.search(r'```[^\n]*\n(.+?)```', text, re.DOTALL)
338
- single_match = re.search(r'`([^`]*)`', text, re.DOTALL)
339
- if triple_match:
340
- return triple_match.group(1)
341
- elif single_match:
342
- return single_match.group(1)
343
- return text
344
-
345
- def run_command(cmd):
346
- try:
347
- exec(cmd, globals(), self.local_dict)
348
- plan_graph = self.local_dict.get('graph')
349
- assert plan_graph is not None
350
- for future in as_completed(plan_graph.future_to_query):
351
- future.result()
352
- plan_graph.future_to_query.clear()
353
- plan_graph.searcher_resp_queue.put(plan_graph.end_signal)
354
- except Exception as e:
355
- logger.exception(f'Error executing code: {e}')
356
-
357
- command = extract_code(command)
358
- producer_thread = threading.Thread(target=run_command,
359
- args=(command, ))
360
- producer_thread.start()
361
-
362
- responses = defaultdict(list)
363
- ordered_nodes = []
364
- active_node = None
365
-
366
- while True:
367
- try:
368
- item = self.local_dict.get('graph').searcher_resp_queue.get(
369
- timeout=60)
370
- if item is WebSearchGraph.end_signal:
371
- for node_name in ordered_nodes:
372
- # resp = None
373
- for resp in responses[node_name]:
374
- yield deepcopy(resp)
375
- # if resp:
376
- # assert resp[1][
377
- # 'detail'].state == AgentStatusCode.END
378
- break
379
- node_name, node, adj = item
380
- if node_name in ['root', 'response']:
381
- yield deepcopy((node_name, node, adj))
382
- else:
383
- if node_name not in ordered_nodes:
384
- ordered_nodes.append(node_name)
385
- responses[node_name].append((node_name, node, adj))
386
- if not active_node and ordered_nodes:
387
- active_node = ordered_nodes[0]
388
- while active_node and responses[active_node]:
389
- if return_early:
390
- if 'detail' in responses[active_node][-1][
391
- 1] and responses[active_node][-1][1][
392
- 'detail'].state == AgentStatusCode.END:
393
- item = responses[active_node][-1]
394
- else:
395
- item = responses[active_node].pop(0)
396
- else:
397
- item = responses[active_node].pop(0)
398
- if 'detail' in item[1] and item[1][
399
- 'detail'].state == AgentStatusCode.END:
400
- ordered_nodes.pop(0)
401
- responses[active_node].clear()
402
- active_node = None
403
- yield deepcopy(item)
404
- except queue.Empty:
405
- if not producer_thread.is_alive():
406
- break
407
- producer_thread.join()
408
- return
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mindsearch/agent/mindsearch_prompt.py DELETED
@@ -1,326 +0,0 @@
1
- # flake8: noqa
2
-
3
- searcher_system_prompt_cn = """## 人物简介
4
- 你是一个可以调用网络搜索工具的智能助手。请根据"当前问题",调用搜索工具收集信息并回复问题。你能够调用如下工具:
5
- {tool_info}
6
- ## 回复格式
7
-
8
- 调用工具时,请按照以下格式:
9
- ```
10
- 你的思考过程...<|action_start|><|plugin|>{{"name": "tool_name", "parameters": {{"param1": "value1"}}}}<|action_end|>
11
- ```
12
-
13
- ## 要求
14
-
15
- - 回答中每个关键点需标注引用的搜索结果来源,以确保信息的可信度。给出索引的形式为`[[int]]`,如果有多个索引,则用多个[[]]表示,如`[[id_1]][[id_2]]`。
16
- - 基于"当前问题"的搜索结果,撰写详细完备的回复,优先回答"当前问题"。
17
-
18
- """
19
-
20
- searcher_system_prompt_en = """## Character Introduction
21
- You are an intelligent assistant that can call web search tools. Please collect information and reply to the question based on the current problem. You can use the following tools:
22
- {tool_info}
23
- ## Reply Format
24
-
25
- When calling the tool, please follow the format below:
26
- ```
27
- Your thought process...<|action_start|><|plugin|>{{"name": "tool_name", "parameters": {{"param1": "value1"}}}}<|action_end|>
28
- ```
29
-
30
- ## Requirements
31
-
32
- - Each key point in the response should be marked with the source of the search results to ensure the credibility of the information. The citation format is `[[int]]`. If there are multiple citations, use multiple [[]] to provide the index, such as `[[id_1]][[id_2]]`.
33
- - Based on the search results of the "current problem", write a detailed and complete reply to answer the "current problem".
34
- """
35
-
36
- fewshot_example_cn = """
37
- ## 样例
38
-
39
- ### search
40
- 当我希望搜索"王者荣耀现在是什么赛季"时,我会按照以下格式进行操作:
41
- 现在是2024年,因此我应该搜索王者荣耀赛季关键词<|action_start|><|plugin|>{{"name": "FastWebBrowser.search", "parameters": {{"query": ["王者荣耀 赛季", "2024年王者荣耀赛季"]}}}}<|action_end|>
42
-
43
- ### select
44
- 为了找到王者荣耀s36赛季最强射手,我需要寻找提及王者荣耀s36射手的网页。初步浏览网页后,发现网页0提到王者荣耀s36赛季的信息,但没有具体提及射手的相关信息。网页3提到“s36最强射手出现?”,有可能包含最强射手信息。网页13提到“四大T0英雄崛起,射手荣耀降临”,可能包含最强射手的信息。因此,我选择了网页3和网页13进行进一步阅读。<|action_start|><|plugin|>{{"name": "FastWebBrowser.select", "parameters": {{"index": [3, 13]}}}}<|action_end|>
45
- """
46
-
47
- fewshot_example_en = """
48
- ## Example
49
-
50
- ### search
51
- When I want to search for "What season is Honor of Kings now", I will operate in the following format:
52
- Now it is 2024, so I should search for the keyword of the Honor of Kings<|action_start|><|plugin|>{{"name": "FastWebBrowser.search", "parameters": {{"query": ["Honor of Kings Season", "season for Honor of Kings in 2024"]}}}}<|action_end|>
53
-
54
- ### select
55
- In order to find the strongest shooters in Honor of Kings in season s36, I needed to look for web pages that mentioned shooters in Honor of Kings in season s36. After an initial browse of the web pages, I found that web page 0 mentions information about Honor of Kings in s36 season, but there is no specific mention of information about the shooter. Webpage 3 mentions that “the strongest shooter in s36 has appeared?”, which may contain information about the strongest shooter. Webpage 13 mentions “Four T0 heroes rise, archer's glory”, which may contain information about the strongest archer. Therefore, I chose webpages 3 and 13 for further reading.<|action_start|><|plugin|>{{"name": "FastWebBrowser.select", "parameters": {{"index": [3, 13]}}}}<|action_end|>
56
- """
57
-
58
- searcher_input_template_en = """## Final Problem
59
- {topic}
60
- ## Current Problem
61
- {question}
62
- """
63
-
64
- searcher_input_template_cn = """## 主问题
65
- {topic}
66
- ## 当前问题
67
- {question}
68
- """
69
-
70
- searcher_context_template_en = """## Historical Problem
71
- {question}
72
- Answer: {answer}
73
- """
74
-
75
- searcher_context_template_cn = """## 历史问题
76
- {question}
77
- 回答:{answer}
78
- """
79
-
80
- search_template_cn = '## {query}\n\n{result}\n'
81
- search_template_en = '## {query}\n\n{result}\n'
82
-
83
- GRAPH_PROMPT_CN = """## 人物简介
84
- 你是一个可以利用 Jupyter 环境 Python 编程的程序员。你可以利用提供的 API 来构建 Web 搜索图,最终生成代码并执行。
85
-
86
- ## API 介绍
87
-
88
- 下面是包含属性详细说明的 `WebSearchGraph` 类的 API 文档:
89
-
90
- ### 类:`WebSearchGraph`
91
-
92
- 此类用于管理网络搜索图的节点和边,并通过网络代理进行搜索。
93
-
94
- #### 初始化方法
95
-
96
- 初始化 `WebSearchGraph` 实例。
97
-
98
- **属性:**
99
-
100
- - `nodes` (Dict[str, Dict[str, str]]): 存储图中所有节点的字典。每个节点由其名称索引,并包含内容、类型以及其他相关信息。
101
- - `adjacency_list` (Dict[str, List[str]]): 存储图中所有节点之间连接关系的邻接表。每个节点由其名称索引,并包含一个相邻节点名称的列表。
102
-
103
-
104
- #### 方法:`add_root_node`
105
-
106
- 添加原始问题作为根节点。
107
- **参数:**
108
-
109
- - `node_content` (str): 用户提出的问题。
110
- - `node_name` (str, 可选): 节点名称,默认为 'root'。
111
-
112
-
113
- #### 方法:`add_node`
114
-
115
- 添加搜索子问题节点并返回搜索结果。
116
- **参数:
117
-
118
- - `node_name` (str): 节点名称。
119
- - `node_content` (str): 子问题内容。
120
-
121
- **返回:**
122
-
123
- - `str`: 返回搜索结果。
124
-
125
-
126
- #### 方法:`add_response_node`
127
-
128
- 当前获取的信息已经满足问题需求,添加回复节点。
129
-
130
- **参数:**
131
-
132
- - `node_name` (str, 可选): 节点名称,默认为 'response'。
133
-
134
-
135
- #### 方法:`add_edge`
136
-
137
- 添加边。
138
-
139
- **参数:**
140
-
141
- - `start_node` (str): 起始节点名称。
142
- - `end_node` (str): 结束节点名称。
143
-
144
-
145
- #### 方法:`reset`
146
-
147
- 重置节点和边。
148
-
149
-
150
- #### 方法:`node`
151
-
152
- 获取节点信息。
153
-
154
- ```python
155
- def node(self, node_name: str) -> str
156
- ```
157
-
158
- **参数:**
159
-
160
- - `node_name` (str): 节点名称。
161
-
162
- **返回:**
163
-
164
- - `str`: 返回包含节点信息的字典,包含节点的内容、类型、思考过程(如果有)和前驱节点列表。
165
-
166
- ## 任务介绍
167
- 通过将一个问题拆分成能够通过搜索回答的子问题(没有关联的问题可以同步并列搜索),每个搜索的问题应该是一个单一问题,即单个具体人、事、物、具体时间点、地点或知识点的问题,不是一个复合问题(比如某个时间段), 一步步构建搜索图,最终回答问题。
168
-
169
- ## 注意事项
170
-
171
- 1. 注意,每个搜索节点的内容必须单个问题,不要包含多个问题(比如同时问多个知识点的问题或者多个事物的比较加筛选,类似 A, B, C 有什么区别,那个价格在哪个区间 -> 分别查询)
172
- 2. 不要杜撰搜索结果,要等待代码返回结果
173
- 3. 同样的问题不要重复提问,可以在已有问题的基础上继续提问
174
- 4. 添加 response 节点的时候,要单独添加,不要和其他节点一起添加,不能同时添加 response 节点和其他节点
175
- 5. 一次输出中,不要包含多个代码块,每次只能有一个代码块
176
- 6. 每个代码块应该放置在一个代码块标记中,同时生成完代码后添加一个<|action_end|>标志,如下所示:
177
- <|action_start|><|interpreter|>```python
178
- # 你的代码块
179
- ```<|action_end|>
180
- 7. 最后一次回复应该是添加node_name为'response'的 response 节点,必须添加 response 节点,不要添加其他节点
181
- """
182
-
183
- GRAPH_PROMPT_EN = """## Character Profile
184
- You are a programmer capable of Python programming in a Jupyter environment. You can utilize the provided API to construct a Web Search Graph, ultimately generating and executing code.
185
-
186
- ## API Description
187
-
188
- Below is the API documentation for the WebSearchGraph class, including detailed attribute descriptions:
189
-
190
- ### Class: WebSearchGraph
191
-
192
- This class manages nodes and edges of a web search graph and conducts searches via a web proxy.
193
-
194
- #### Initialization Method
195
-
196
- Initializes an instance of WebSearchGraph.
197
-
198
- **Attributes:**
199
-
200
- - nodes (Dict[str, Dict[str, str]]): A dictionary storing all nodes in the graph. Each node is indexed by its name and contains content, type, and other related information.
201
- - adjacency_list (Dict[str, List[str]]): An adjacency list storing the connections between all nodes in the graph. Each node is indexed by its name and contains a list of adjacent node names.
202
-
203
- #### Method: add_root_node
204
-
205
- Adds the initial question as the root node.
206
- **Parameters:**
207
-
208
- - node_content (str): The user's question.
209
- - node_name (str, optional): The node name, default is 'root'.
210
-
211
- #### Method: add_node
212
-
213
- Adds a sub-question node and returns search results.
214
- **Parameters:**
215
-
216
- - node_name (str): The node name.
217
- - node_content (str): The sub-question content.
218
-
219
- **Returns:**
220
-
221
- - str: Returns the search results.
222
-
223
- #### Method: add_response_node
224
-
225
- Adds a response node when the current information satisfies the question's requirements.
226
-
227
- **Parameters:**
228
-
229
- - node_name (str, optional): The node name, default is 'response'.
230
-
231
- #### Method: add_edge
232
-
233
- Adds an edge.
234
-
235
- **Parameters:**
236
-
237
- - start_node (str): The starting node name.
238
- - end_node (str): The ending node name.
239
-
240
- #### Method: reset
241
-
242
- Resets nodes and edges.
243
-
244
- #### Method: node
245
-
246
- Get node information.
247
-
248
- python
249
- def node(self, node_name: str) -> str
250
-
251
- **Parameters:**
252
-
253
- - node_name (str): The node name.
254
-
255
- **Returns:**
256
-
257
- - str: Returns a dictionary containing the node's information, including content, type, thought process (if any), and list of predecessor nodes.
258
-
259
- ## Task Description
260
- By breaking down a question into sub-questions that can be answered through searches (unrelated questions can be searched concurrently), each search query should be a single question focusing on a specific person, event, object, specific time point, location, or knowledge point. It should not be a compound question (e.g., a time period). Step by step, build the search graph to finally answer the question.
261
-
262
- ## Considerations
263
-
264
- 1. Each search node's content must be a single question; do not include multiple questions (e.g., do not ask multiple knowledge points or compare and filter multiple things simultaneously, like asking for differences between A, B, and C, or price ranges -> query each separately).
265
- 2. Do not fabricate search results; wait for the code to return results.
266
- 3. Do not repeat the same question; continue asking based on existing questions.
267
- 4. When adding a response node, add it separately; do not add a response node and other nodes simultaneously.
268
- 5. In a single output, do not include multiple code blocks; only one code block per output.
269
- 6. Each code block should be placed within a code block marker, and after generating the code, add an <|action_end|> tag as shown below:
270
- <|action_start|><|interpreter|>
271
- ```python
272
- # Your code block (Note that the 'Get new added node information' logic must be added at the end of the code block, such as 'graph.node('...')')
273
- ```<|action_end|>
274
- 7. The final response should add a response node with node_name 'response', and no other nodes should be added.
275
- """
276
-
277
- graph_fewshot_example_cn = """
278
- ## 返回格式示例
279
- <|action_start|><|interpreter|>```python
280
- graph = WebSearchGraph()
281
- graph.add_root_node(node_content="哪家大模型API最便宜?", node_name="root") # 添加原始问题作为根节点
282
- graph.add_node(
283
- node_name="大模型API提供商", # 节点名称最好有意义
284
- node_content="目前有哪些主要的大模型API提供商?")
285
- graph.add_node(
286
- node_name="sub_name_2", # 节点名称最好有意义
287
- node_content="content of sub_name_2")
288
- ...
289
- graph.add_edge(start_node="root", end_node="sub_name_1")
290
- ...
291
- graph.node("大模型API提供商"), graph.node("sub_name_2"), ...
292
- ```<|action_end|>
293
- """
294
-
295
- graph_fewshot_example_en = """
296
- ## Response Format
297
- <|action_start|><|interpreter|>```python
298
- graph = WebSearchGraph()
299
- graph.add_root_node(node_content="Which large model API is the cheapest?", node_name="root") # Add the original question as the root node
300
- graph.add_node(
301
- node_name="Large Model API Providers", # The node name should be meaningful
302
- node_content="Who are the main large model API providers currently?")
303
- graph.add_node(
304
- node_name="sub_name_2", # The node name should be meaningful
305
- node_content="content of sub_name_2")
306
- ...
307
- graph.add_edge(start_node="root", end_node="sub_name_1")
308
- ...
309
- # Get node info
310
- graph.node("Large Model API Providers"), graph.node("sub_name_2"), ...
311
- ```<|action_end|>
312
- """
313
-
314
- FINAL_RESPONSE_CN = """基于提供的问答对,撰写一篇详细完备的最终回答。
315
- - 回答内容需要逻辑清晰,层次分明,确保读者易于理解。
316
- - 回答中每个关键点需标注引用的搜索结果来源(保持跟问答对中的索引一致),以确保信息的可信度。给出索引的形式为`[[int]]`,如果有多个索引,则用多个[[]]表示,如`[[id_1]][[id_2]]`。
317
- - 回答部分需要全面且完备,不要出现"基于上述内容"等模糊表达,最终呈现的回答不包括提供给你的问答对。
318
- - 语言风格需要专业、严谨,避免口语化表达。
319
- - 保持统一的语法和词汇使用,确保整体文档的一致性和连贯性。"""
320
-
321
- FINAL_RESPONSE_EN = """Based on the provided Q&A pairs, write a detailed and comprehensive final response.
322
- - The response content should be logically clear and well-structured to ensure reader understanding.
323
- - Each key point in the response should be marked with the source of the search results (consistent with the indices in the Q&A pairs) to ensure information credibility. The index is in the form of `[[int]]`, and if there are multiple indices, use multiple `[[]]`, such as `[[id_1]][[id_2]]`.
324
- - The response should be comprehensive and complete, without vague expressions like "based on the above content". The final response should not include the Q&A pairs provided to you.
325
- - The language style should be professional and rigorous, avoiding colloquial expressions.
326
- - Maintain consistent grammar and vocabulary usage to ensure overall document consistency and coherence."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mindsearch/agent/models.py DELETED
@@ -1,40 +0,0 @@
1
- import os
2
-
3
- from lagent.llms import (GPTAPI, INTERNLM2_META, HFTransformerCasualLM,
4
- LMDeployClient, LMDeployServer)
5
-
6
- internlm_server = dict(type=LMDeployServer,
7
- path='internlm/internlm2_5-7b-chat',
8
- model_name='internlm2',
9
- meta_template=INTERNLM2_META,
10
- top_p=0.8,
11
- top_k=1,
12
- temperature=0,
13
- max_new_tokens=8192,
14
- repetition_penalty=1.02,
15
- stop_words=['<|im_end|>'])
16
-
17
- internlm_client = dict(type=LMDeployClient,
18
- model_name='internlm2_5-7b-chat',
19
- url='http://127.0.0.1:23333',
20
- meta_template=INTERNLM2_META,
21
- top_p=0.8,
22
- top_k=1,
23
- temperature=0,
24
- max_new_tokens=8192,
25
- repetition_penalty=1.02,
26
- stop_words=['<|im_end|>'])
27
-
28
- internlm_hf = dict(type=HFTransformerCasualLM,
29
- path='internlm/internlm2_5-7b-chat',
30
- meta_template=INTERNLM2_META,
31
- top_p=0.8,
32
- top_k=None,
33
- temperature=1e-6,
34
- max_new_tokens=8192,
35
- repetition_penalty=1.02,
36
- stop_words=['<|im_end|>'])
37
-
38
- gpt4 = dict(type=GPTAPI,
39
- model_type='gpt-4-turbo',
40
- key=os.environ.get('OPENAI_API_KEY', 'YOUR OPENAI API KEY'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mindsearch/app.py DELETED
@@ -1,128 +0,0 @@
1
- import asyncio
2
- import json
3
- import logging
4
- from copy import deepcopy
5
- from dataclasses import asdict
6
- from typing import Dict, List, Union
7
-
8
- import janus
9
- from fastapi import FastAPI
10
- from fastapi.middleware.cors import CORSMiddleware
11
- from lagent.schema import AgentStatusCode
12
- from pydantic import BaseModel
13
- from sse_starlette.sse import EventSourceResponse
14
-
15
- from mindsearch.agent import init_agent
16
- import spaces
17
-
18
-
19
- def parse_arguments():
20
- import argparse
21
- parser = argparse.ArgumentParser(description='MindSearch API')
22
- parser.add_argument('--lang', default='cn', type=str, help='Language')
23
- parser.add_argument('--model_format',
24
- default='internlm_server',
25
- type=str,
26
- help='Model format')
27
- return parser.parse_args()
28
-
29
-
30
- args = parse_arguments()
31
- app = FastAPI(docs_url='/')
32
-
33
- app.add_middleware(CORSMiddleware,
34
- allow_origins=['*'],
35
- allow_credentials=True,
36
- allow_methods=['*'],
37
- allow_headers=['*'])
38
-
39
-
40
- class GenerationParams(BaseModel):
41
- inputs: Union[str, List[Dict]]
42
- agent_cfg: Dict = dict()
43
-
44
- @app.post('/solve')
45
- async def run(request: GenerationParams):
46
-
47
- def convert_adjacency_to_tree(adjacency_input, root_name):
48
-
49
- def build_tree(node_name):
50
- node = {'name': node_name, 'children': []}
51
- if node_name in adjacency_input:
52
- for child in adjacency_input[node_name]:
53
- child_node = build_tree(child['name'])
54
- child_node['state'] = child['state']
55
- child_node['id'] = child['id']
56
- node['children'].append(child_node)
57
- return node
58
-
59
- return build_tree(root_name)
60
-
61
- @spaces.GPU(duration=180)
62
- async def generate():
63
- try:
64
- queue = janus.Queue()
65
-
66
- # 使用 run_in_executor 将同步生成器包装成异步生成器
67
- def sync_generator_wrapper():
68
- try:
69
- for response in agent.stream_chat(inputs):
70
- queue.sync_q.put(response)
71
- except Exception as e:
72
- logging.exception(
73
- f'Exception in sync_generator_wrapper: {e}')
74
- finally:
75
- # 确保在发生异常时队列中的所有元素都被消费
76
- queue.sync_q.put(None)
77
-
78
- async def async_generator_wrapper():
79
- loop = asyncio.get_event_loop()
80
- loop.run_in_executor(None, sync_generator_wrapper)
81
- while True:
82
- response = await queue.async_q.get()
83
- if response is None: # 确保消费完所有元素
84
- break
85
- yield response
86
- if not isinstance(
87
- response,
88
- tuple) and response.state == AgentStatusCode.END:
89
- break
90
-
91
- async for response in async_generator_wrapper():
92
- if isinstance(response, tuple):
93
- agent_return, node_name = response
94
- else:
95
- agent_return = response
96
- node_name = None
97
- origin_adj = deepcopy(agent_return.adjacency_list)
98
- adjacency_list = convert_adjacency_to_tree(
99
- agent_return.adjacency_list, 'root')
100
- assert adjacency_list[
101
- 'name'] == 'root' and 'children' in adjacency_list
102
- agent_return.adjacency_list = adjacency_list['children']
103
- agent_return = asdict(agent_return)
104
- agent_return['adj'] = origin_adj
105
- response_json = json.dumps(dict(response=agent_return,
106
- current_node=node_name),
107
- ensure_ascii=False)
108
- yield {'data': response_json}
109
- # yield f'data: {response_json}\n\n'
110
- except Exception as exc:
111
- msg = 'An error occurred while generating the response.'
112
- logging.exception(msg)
113
- response_json = json.dumps(
114
- dict(error=dict(msg=msg, details=str(exc))),
115
- ensure_ascii=False)
116
- yield {'data': response_json}
117
- # yield f'data: {response_json}\n\n'
118
- finally:
119
- queue.close()
120
- await queue.wait_closed()
121
-
122
- inputs = request.inputs
123
- agent = init_agent(lang=args.lang, model_format=args.model_format)
124
- return EventSourceResponse(generate())
125
-
126
- if __name__ == '__main__':
127
- import uvicorn
128
- uvicorn.run(app, host='0.0.0.0', port=8002, log_level='info')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
mindsearch/terminal.py DELETED
@@ -1,50 +0,0 @@
1
- from datetime import datetime
2
-
3
- from lagent.actions import ActionExecutor, BingBrowser
4
- from lagent.llms import INTERNLM2_META, LMDeployServer
5
-
6
- from mindsearch.agent.mindsearch_agent import (MindSearchAgent,
7
- MindSearchProtocol)
8
- from mindsearch.agent.mindsearch_prompt import (
9
- FINAL_RESPONSE_CN, FINAL_RESPONSE_EN, GRAPH_PROMPT_CN, GRAPH_PROMPT_EN,
10
- searcher_context_template_cn, searcher_context_template_en,
11
- searcher_input_template_cn, searcher_input_template_en,
12
- searcher_system_prompt_cn, searcher_system_prompt_en)
13
-
14
- lang = 'cn'
15
- llm = LMDeployServer(path='internlm/internlm2_5-7b-chat',
16
- model_name='internlm2',
17
- meta_template=INTERNLM2_META,
18
- top_p=0.8,
19
- top_k=1,
20
- temperature=0,
21
- max_new_tokens=8192,
22
- repetition_penalty=1.02,
23
- stop_words=['<|im_end|>'])
24
-
25
- agent = MindSearchAgent(
26
- llm=llm,
27
- protocol=MindSearchProtocol(
28
- meta_prompt=datetime.now().strftime('The current date is %Y-%m-%d.'),
29
- interpreter_prompt=GRAPH_PROMPT_CN
30
- if lang == 'cn' else GRAPH_PROMPT_EN,
31
- response_prompt=FINAL_RESPONSE_CN
32
- if lang == 'cn' else FINAL_RESPONSE_EN),
33
- searcher_cfg=dict(
34
- llm=llm,
35
- plugin_executor=ActionExecutor(
36
- BingBrowser(searcher_type='DuckDuckGoSearch', topk=6)),
37
- protocol=MindSearchProtocol(
38
- meta_prompt=datetime.now().strftime(
39
- 'The current date is %Y-%m-%d.'),
40
- plugin_prompt=searcher_system_prompt_cn
41
- if lang == 'cn' else searcher_system_prompt_en,
42
- ),
43
- template=dict(input=searcher_input_template_cn
44
- if lang == 'cn' else searcher_input_template_en,
45
- context=searcher_context_template_cn
46
- if lang == 'cn' else searcher_context_template_en)),
47
- max_turn=10)
48
-
49
- for agent_return in agent.stream_chat('上海今天适合穿什么衣服'):
50
- pass