Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

feat: Added UI functions related to data-flow knowledge base #3221 (#10038)

chanx8a09f07186a6
diff --git a/web/package-lock.json b/web/package-lock.json
index 1579cf2401..e1b4f45814 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -66,7 +66,7 @@
"jsencrypt": "^3.3.2",
"lexical": "^0.23.1",
"lodash": "^4.17.21",
- "lucide-react": "^0.508.0",
+ "lucide-react": "^0.542.0",
"mammoth": "^1.7.2",
"next-themes": "^0.4.6",
"openai-speech-stream-player": "^1.0.8",
@@ -25113,9 +25113,9 @@
}
},
"node_modules/lucide-react": {
- "version": "0.508.0",
- "resolved": "https://registry.npmmirror.com/lucide-react/-/lucide-react-0.508.0.tgz",
- "integrity": "sha512-gcP16PnexqtOFrTtv98kVsGzTfnbPekzZiQfByi2S89xfk7E/4uKE1USZqccIp58v42LqkO7MuwpCqshwSrJCg==",
+ "version": "0.542.0",
+ "resolved": "https://registry.npmmirror.com/lucide-react/-/lucide-react-0.542.0.tgz",
+ "integrity": "sha512-w3hD8/SQB7+lzU2r4VdFyzzOzKnUjTZIF/MQJGSSvni7Llewni4vuViRppfRAa2guOsY5k4jZyxw/i9DQHv+dw==",
"license": "ISC",
"peerDependencies": {
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
diff --git a/web/package.json b/web/package.json
index 2e7a9c0f71..783ffff66d 100644
--- a/web/package.json
+++ b/web/package.json
@@ -79,7 +79,7 @@
"jsencrypt": "^3.3.2",
"lexical": "^0.23.1",
"lodash": "^4.17.21",
- "lucide-react": "^0.508.0",
+ "lucide-react": "^0.542.0",
"mammoth": "^1.7.2",
"next-themes": "^0.4.6",
"openai-speech-stream-player": "^1.0.8",
diff --git a/web/src/assets/svg/data-flow/knowledgegraph.svg b/web/src/assets/svg/data-flow/knowledgegraph.svg
new file mode 100644
index 0000000000..b0feec9249
--- /dev/null
+++ b/web/src/assets/svg/data-flow/knowledgegraph.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756884949583" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11332" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M190.464 489.472h327.68v40.96h-327.68z" fill="#C7DCFE" p-id="11333"></path><path d="M482.34496 516.5056l111.26784-308.20352 38.54336 13.9264L520.86784 530.432z" fill="#C7DCFE" p-id="11334"></path><path d="M620.544 196.608m-122.88 0a122.88 122.88 0 1 0 245.76 0 122.88 122.88 0 1 0-245.76 0Z" fill="#8FB8FC" p-id="11335"></path><path d="M182.272 509.952m-122.88 0a122.88 122.88 0 1 0 245.76 0 122.88 122.88 0 1 0-245.76 0Z" fill="#C7DCFE" p-id="11336"></path><path d="M558.65344 520.9088l283.77088 163.84-20.48 35.47136-283.77088-163.84z" fill="#C7DCFE" p-id="11337"></path><path d="M841.728 686.08m-122.88 0a122.88 122.88 0 1 0 245.76 0 122.88 122.88 0 1 0-245.76 0Z" fill="#B3CEFE" p-id="11338"></path><path d="M448.67584 803.77856l49.60256-323.91168 40.48896 6.20544-49.60256 323.91168z" fill="#C7DCFE" p-id="11339"></path><path d="M512 530.432m-143.36 0a143.36 143.36 0 1 0 286.72 0 143.36 143.36 0 1 0-286.72 0Z" fill="#4185FF" p-id="11340"></path><path d="M462.848 843.776m-102.4 0a102.4 102.4 0 1 0 204.8 0 102.4 102.4 0 1 0-204.8 0Z" fill="#8FB8FC" p-id="11341"></path></svg>
\ No newline at end of file
diff --git a/web/src/assets/svg/data-flow/raptor.svg b/web/src/assets/svg/data-flow/raptor.svg
new file mode 100644
index 0000000000..8f83bffc24
--- /dev/null
+++ b/web/src/assets/svg/data-flow/raptor.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1756884908677" class="icon" viewBox="0 0 1039 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11186" xmlns:xlink="http://www.w3.org/1999/xlink" width="202.9296875" height="200"><path d="M653.90935344 53.93964406c1.26171656 0.69905906 2.86687313 2.30421562 3.56593219 3.56593219 0.69905906 1.26171656 1.28607375 1.73425125 1.30556062 1.04980688 0.04384313-1.61246438-4.30883531-5.96514281-5.92129969-5.92129875-0.68444437 0.01948594-0.21190969 0.60650063 1.04980688 1.30555968m-209.72749781 23.39290688c-1.49311219 0.99622031-3.5001675 5.02494469-2.50638282 5.02494469 0.95724844 0 5.0005875-4.12615406 5.0005875-5.10288844 0-0.85251094-1.15697906-0.81597469-2.49420468 0.07794375m-30.74642438 76.49217656c-1.12044375 0.78431062-2.26524375 2.30178-2.54535562 3.37350844-0.6454725 2.46741094-0.55047844 2.45036063 2.60381343-0.47009906 3.03250406-2.81085094 2.98866094-5.03712375-0.05845781-2.90340938m29.83789125 122.86878469c-1.40786156 1.40786156-2.28472969 2.8327725-1.94859656 3.16890562 0.33613313 0.33613313 1.76348062-0.54073594 3.17134125-1.94859656 1.40786156-1.40786156 2.28472969-2.83520906 1.9485975-3.16890562-0.33613313-0.33613313-1.76348062 0.54073594-3.17134219 1.94859656m181.00030594 42.51838687c0.02679281 1.32261 1.40299031 2.82059437 3.69989812 4.03116 1.88039625 0.99134906 2.14832812 0.97429875 1.53452063-0.09499406-2.01436219-3.51965344-5.27582625-5.97244969-5.23441875-3.93616594m-174.16560188 79.07650313c-1.01570625 0.98647687-1.39324687 1.79514469-0.83789625 1.79514469 1.10826469 0 3.66823406-2.72316469 3.0617325-3.25902844-0.20703844-0.18268125-1.20813 0.47497031-2.22383625 1.46388375m264.44653781 19.57852875c-0.11935125 1.80975938 2.90097375 5.25390469 4.54753782 5.18813906 1.2812025-0.05115094 1.18864406-0.27523969-0.43112719-1.05954937-1.13262187-0.54804281-2.50881844-1.92423938-3.05686125-3.05442563-0.54804281-1.13262187-1.02544875-1.6149-1.05954937-1.07416406m129.50132156 9.36787969c1.31043187 0.66252281 2.92289531 2.27498719 3.58541906 3.58541906 0.88661156 1.75130156 1.20813 1.93641844 1.22030906 0.69905906 0.01705031-2.16537844-3.33940781-5.52183656-5.50722281-5.50478719-1.23492375 0.00974344-1.04980688 0.33126187 0.70149469 1.22030907m-529.46060344 15.81773625c-1.49311219 0.99622031-3.5001675 5.02494469-2.50638281 5.02494468 0.95724844 0 5.0005875-4.12371844 5.0005875-5.10045281 0-0.85251094-1.15697906-0.81597469-2.49420469 0.07550813m-207.76672125 92.45849343c-1.52477719 2.84738719-0.75021 3.03006844 1.28850937 0.30446813 0.947505-1.26902344 1.28850937-2.30665219 0.75264563-2.30665219-0.53342813 0-1.45170469 0.90122625-2.041155 2.00218406m213.38355281 27.99646688c-3.28338563 2.29447313-3.94590937 3.59759719-1.83168187 3.59759812 1.24466625 0 3.43683844-2.05576969 4.85931375-4.55971781 0.94263375-1.6563075 0.52855688-1.52234156-3.02763188 0.96211969m101.26615125 13.87401094a13.676715 13.676715 0 0 0 4.32101344 0c1.18864406-0.22896 0.21678187-0.41407688-2.16050719-0.41407688-2.3748525 0-3.34671562 0.18511687-2.16050625 0.41407688m286.65323625 32.20056562c-4.5110025 5.14673156-4.90072125 6.07718719-1.55887781 3.73399969 3.13724156-2.19947906 5.81899781-5.89450594 4.27717031-5.89450594-0.45304875 0-1.67822906 0.97186312-2.7182925 2.16050625m288.73579875 0.06089438c-3.49286063 3.71694844-1.85603906 5.22711188 1.75130156 1.61733562 1.97782594-1.97539031 2.52586875-3.83873625 1.12775063-3.83873625-0.43599844 0-1.73181562 1.00109156-2.87905219 2.22140063m-532.60271625 38.333775c-3.3223575 3.69259125-3.66823406 4.92020719-0.86956125 3.08365406 2.65496344-1.73668687 5.08827375-5.24172562 3.64144031-5.24172563-0.45548437 0-1.70258625 0.97186312-2.77187906 2.15807157m388.45038 14.52191906c0 1.47119062 1.51259813 2.86200187 4.12858969 3.79732781 1.8536025 0.66252281 1.54669875-0.23383125-1.16185031-3.39786562-1.761045-2.05576969-2.96673937-2.218965-2.96673938-0.39946219m-198.49383562 54.40969969c0.90366188 0.52612125 2.30908781 1.90475344 3.12019125 3.06416906 0.81110344 1.15697906 1.47362625 1.57592812 1.47362625 0.93045562 0-1.54669875-3.51234656-5.02007344-5.03955844-4.98353718-0.68200875 0.01705031-0.489585 0.44330625 0.44574094 0.9889125m36.27069843 22.77909937c0 0.97429875 4.13346188 5.0005875 5.1345525 5.0005875 0.37997625 0 0.23383125-0.85494656-0.32395406-1.89744656-1.10095687-2.05820531-4.81059844-4.45010812-4.81059844-3.10314094m17.96606438 16.38039375c3.05199 2.94238125 3.74861344 3.04711875 2.29934437 0.34100438-0.55291406-1.03519219-1.89988219-2.11666313-2.98866093-2.40164532-1.70745844-0.44574188-1.61002875-0.15832313 0.68931656 2.06064094m-403.8467325 20.11195688c0 1.29825281 2.29447313 3.719385 4.13102531 4.35998625 1.20325875 0.41894813 1.52477719 0.24113906 1.0522425-0.58701469-1.97295469-3.47093812-5.18326781-5.80681875-5.18326781-3.77297156m-213.99248906 15.08944875c-0.11935125 1.80488812 2.72560031 5.00545875 4.94456531 5.56567968 2.11179188 0.5309925 2.12153531 0.50176406 0.32638969-0.84033187-1.02544875-0.76482469-2.1458925-1.39324687-2.49176813-1.39324688-0.34831125 0-1.09852125-0.97186312-1.67335781-2.15807156-0.5724-1.18864406-1.06929281-1.71720094-1.10582906-1.17402937m373.336575 136.54549968c0 1.53208406 3.03737531 5.01276563 4.3746 5.01276657 1.97782594 0 1.72938-0.73072406-1.15454344-3.40517344-2.72560031-2.52586875-3.22005656-2.77187906-3.22005656-1.60759313m213.26420062 47.55063938c-3.49042406 3.71694844-1.85603906 5.22711188 1.75373719 1.61733562 1.97782594-1.97782594 2.52343312-3.83873625 1.12775062-3.83873625-0.43599844 0-1.73181562 0.99865594-2.88148781 2.22140063" fill="#bfbfbf" p-id="11187"></path><path d="M508.11045312 34.32214344c0 1.67822906-0.78918188 1.90718906-7.43876906 2.15807156l-7.43876906 0.28011094-0.29959688 3.60003281-0.29716125 3.60003281h-6.46934249c-7.15865812 0-8.77355812 0.91827656-8.77355813 4.99084406 0 2.49664031-0.27280313 2.68906406-3.83873625 2.68906407-3.07878375 0-3.84117187 0.34831125-3.84117187 1.75130156 0 2.59163437-3.81437906 5.677725-7.96489032 6.44498437-4.18461187 0.77213156-6.43280625 2.6354775-6.43280531 5.33428407 0 1.32017437-0.86225438 2.04846281-2.91315281 2.45766843-3.19082719 0.63816563-4.17974062 1.97051906-5.23929 7.04904938-0.80379656 3.86309344-2.905845 6.58138688-6.00655031 7.76515969-1.67335781 0.64060125-2.15807156 1.58567062-2.15807157 4.20896906 0 3.20300625-0.17293781 3.38325188-3.2395425 3.38325187-3.45145219 0-4.44036563 1.93641844-4.44036562 8.69074219 0 2.47228219-2.92289531 5.88232687-5.88719813 6.87124031-0.54560719 0.18268125-1.2812025 3.55375406-1.63195031 7.49479125-0.62842219 7.03199906-0.69418781 7.17570844-3.51965344 7.65798657-3.30774375 0.56752875-3.96539531 4.27960594-4.20166218 23.72904l-0.11935125 9.80631468-3.35889469 3.35889469-3.35889375 3.36132938 0.09499406 9.86964375c0.11691562 11.94733594 0.69662344 14.31975281 3.88014375 15.8542725 2.43574594 1.17402937 2.45766844 1.29094594 2.99109656 15.89811656 0.5724 15.67646344 1.87308844 21.12035625 5.31479813 22.21156969 1.58567062 0.50419969 2.00949094 1.81706719 2.58919875 8.01117 0.71367375 7.65555094 1.37376094 8.81009438 5.04686625 8.83445156 1.70989406 0.01217906 2.16294281 0.56509312 2.17512094 2.65496344 0.02679281 4.79354906 2.49907594 10.25692781 5.06148093 11.1873825 1.77809438 0.6454725 2.6038125 1.87796063 3.21762094 4.79842031 0.74046656 3.5318325 1.14480094 3.96295875 3.94590844 4.23332719l3.11775562 0.29959687v5.53157906c0 5.71182469-1.65874312 8.48126812-5.99924343 10.01335313-1.16915813 0.41164125-1.67822906 1.61977125-1.67822907 3.98244562 0 3.23223562-0.1558875 3.39055875-3.34915125 3.39055875-3.1567275 0-3.38325188 0.21678187-3.95321625 3.78514969-0.54317156 3.38812312-0.92558344 3.81925031-3.61221093 4.07987438-2.71585688 0.26549625-3.03250406 0.63816563-3.3028725 3.88014375-0.25818937 3.11288344-0.69418781 3.69015563-3.29312907 4.36242187-3.24684938 0.84276844-3.99218812 2.32613812-5.03225156 10.04988938-0.59675813 4.43549438-0.70149469 4.55728125-3.91424437 4.55728125-3.20300625 0-3.30043594 0.11448-3.30043594 3.78271406 0 3.67797656-0.09986531 3.79002094-3.60003281 4.07987437-3.40517344 0.28254656-3.6146475 0.49202062-3.89719407 3.89719407-0.2703675 3.26389969-0.55778625 3.60003281-3.08609062 3.60003375-3.26877187 0-4.77649875 2.19947906-4.77649875 6.96867 0 3.30287156-2.47228219 6.49126406-5.99924344 7.73593031-1.15454344 0.40677-1.67822906 1.6149-1.67822906 3.86065781 0 3.06173344-0.23870344 3.30530813-3.78271406 3.87040031-3.54888187 0.56752875-3.79976437 0.82571813-4.07987438 4.20409782-0.26549625 3.20057063-0.61380844 3.63169781-3.17377781 3.92398781-3.33210094 0.37754063-4.28691375 1.52721281-4.30883532 5.17352531-0.00974344 2.01923344-0.58945031 2.76700781-2.51612531 3.249285-2.90828063 0.73072406-5.17596094 5.26851938-5.17596094 10.35922875 0 3.1567275-0.18998813 3.34915125-3.60003281 3.62926219-3.40517344 0.28254656-3.61708313 0.49445625-3.89719406 3.89962969-0.2703675 3.26389969-0.55778625 3.59759719-3.08609063 3.59759718-2.95699594 0-4.77649875 2.16050719-4.77649875 5.67041719 0 1.40299031-0.88174031 2.17999313-3.12019125 2.75482969-3.03493969 0.77700281-3.14211281 0.98404125-3.99705937 7.65798562l-0.87686813 6.85906219-3.44170968 0.28741781c-3.22492781 0.2703675-3.46119563 0.51637781-3.74130657 3.88745063-0.28011094 3.40273781-0.47740594 3.60003281-3.58785375 3.60003375-3.09583312 0-3.32479406 0.22652438-3.90450187 3.84117187-0.489585 3.07147594-1.0205775 3.84117187-2.65009219 3.85335-3.25172156 0.02435719-4.10179688 1.12044375-4.77649781 6.16974563-0.62598656 4.67906812-3.53913937 9.17302031-5.94322125 9.17302031-0.63329437 0-1.4273475 1.72938-1.76591625 3.84117188-0.57970781 3.62682656-0.79648875 3.83873625-3.96052312 3.83873625-3.25902844 0-3.34915125 0.10230094-3.34915125 3.78271406 0 3.67554094-0.09986531 3.79002094-3.60003282 4.07987531-3.38081625 0.27767531-3.61708313 0.50907094-3.88988718 3.78758531-0.25088156 3.00571125-0.68444437 3.56836875-3.13724063 4.05795282-3.33940781 0.66739406-4.73021906 3.52939594-4.73022 9.73324218 0 4.16025469-0.03410062 4.20166219-3.60003281 4.49882344-3.40517344 0.28011094-3.61708313 0.49202062-3.89719406 3.89719406-0.25331719 3.05686125-0.64060125 3.60003281-2.562405 3.60003282-4.11641156 0-5.30018344 0.99134906-5.30018344 4.44523687 0 2.88635906-0.35074781 3.35158687-2.91315281 3.86309344-3.40273781 0.68200875-4.76675531 2.76944344-4.76675532 7.29749625 0 3.52696031-3.18352031 7.43146219-6.06013687 7.43146219-1.24466625 0-1.61733562 0.8744325-1.61733563 3.7802775 0 3.67797656-0.09986531 3.79002094-3.60003281 4.07987531-3.40517344 0.28254656-3.61708313 0.49445625-3.89719406 3.89719406-0.27280313 3.29069344-0.54560719 3.60003281-3.16647 3.60003281-2.31883031 0-3.12749812 0.59919375-4.22358469 3.12019125-1.15210781 2.64765656-1.36158187 2.78892937-1.39324594 0.93532688-0.05358656-3.06660469-3.3540225-4.05551719-13.54031437-4.05551813-8.2498725 0-8.57626219-0.082815-8.59087688-2.16050625-0.03410062-5.22467531 1.61246438-5.03955938-44.437755-5.03955937-45.82856625 0-45.77741531-0.00487125-45.77741531 4.91777156 0 2.21409375-0.23383125 2.28229406-7.67990812 2.28229406h-7.67990813l-3.83873625 3.83873625c-3.09583312 3.09583312-4.53779531 3.84604312-7.43876906 3.86552907-3.14211281 0.02435719-3.89475844 0.50663531-5.92617 3.79732875-2.20678594 3.57811125-2.59894125 3.78514969-7.6774725 4.05308156l-5.35377094 0.28498312-0.29959594 3.59759719c-0.28985344 3.5001675-0.40189781 3.60003281-4.07987531 3.60003281-3.770535 0-3.78027844 0.00974344-3.78027844 3.84117188v3.83873625h-7.67990812v7.67990812h-3.83873625c-3.82899281 0-3.84117187 0.00974344-3.84117188 3.7802775 0 3.67797656-0.09742969 3.79002094-3.59759718 4.07987532-3.40517344 0.28254656-3.61708313 0.49445625-3.89719407 3.89719406-0.24601031 2.96673937-0.66739406 3.60246844-2.40164531 3.6146475-3.85578656 0.02679281-4.7911125 1.47119062-5.37812812 8.29858781-0.55047844 6.43280625-0.62111531 6.57164344-3.43927407 6.89316188-3.82412156 0.43356281-4.291785 1.40786156-4.30883437 9.03174656-0.01217906 5.8336125-0.20460281 6.479085-1.93398281 6.47908594-1.89501094 0-1.91936813 0.64060125-1.91936813 52.31495812s0.02435719 52.31495812 1.91936813 52.31495813c1.74399469 0 1.91936813 0.63816563 1.91936812 7.00520625 0 7.72618687 0.85251094 9.31185844 4.99327969 9.31185843 2.57945531 0 2.68662844 0.18998813 2.68662844 4.73752594 0 6.70317375 1.20569437 9.27775781 4.66445343 9.96951 2.53317656 0.50663531 2.93263875 1.03275656 3.19569938 4.21627688 0.28254656 3.43196625 0.49445625 3.65118375 3.8436075 3.92885906 3.33210094 0.27767531 3.56349656 0.50907094 3.84117187 3.83873531 0.27523969 3.33210094 0.50663531 3.56349656 3.83873625 3.84117188 3.32966531 0.27767531 3.56349656 0.50907094 3.83873625 3.83873625 0.27767531 3.34184344 0.50176406 3.56349656 3.89475844 3.8436075 3.38081625 0.28011094 3.60003281 0.49202062 3.60003281 3.49773187 0 3.37837969 1.21056562 4.36242187 5.35864219 4.36242188 1.9997475 0 2.32126594 0.45304875 2.32126594 3.2712075 0 3.19082719 0.11204438 3.28338563 4.76188406 3.92398687 3.29800031 0.45304875 4.92264281 1.16915813 5.29044094 2.32613719 0.61137188 1.92180375 7.9064325 5.83848375 10.87804312 5.83848469 1.22030906 0 2.4893325 1.00352719 3.25415625 2.57701875 1.45657594 3.00083906 3.8119425 3.77297063 14.30513813 4.68881156 6.93944156 0.604065 7.58491406 0.83789625 7.58491406 2.74508625 0 4.39408594-0.08037937 4.38677906 45.68485688 4.38677906 46.7297925 0 44.54492812 0.23383125 44.54492812-4.74726937 0-1.48824094 1.3956825-1.82193844 10.76843438-2.562405l10.76843437-0.85007532 0.86712563-3.03737531c0.81841031-2.87661656 1.17890156-3.07634719 6.7494525-3.70720594 6.72996656-0.76482469 8.28397312-1.68066469 8.28397312-4.89097875 0-1.80975938 0.50907094-2.28229406 2.46253969-2.28229406 3.999495 0 6.17461687-1.68310031 6.17461687-4.77406312 0-2.52830438 0.33613313-2.81815875 3.59272594-3.08609063 2.58432656-0.21434531 3.68528437-0.79405313 3.9264225-2.06551219 0.39946219-2.10935625 3.51478219-5.40492094 5.20031813-5.50235156 2.2603725-0.13153031 6.9589275-3.40517344 7.9064325-5.50722187 1.22761594-2.72316469 3.15429187-2.69637094 3.54644718 0.04871437 0.4165125 2.92776656 4.78624125 4.864185 12.08373657 5.35133531 5.13698906 0.34344 6.29640375 0.77456719 7.90886812 2.93020219 1.04006344 1.38837562 2.3431875 3.06660469 2.89853813 3.72669188 0.61624406 0.73072406 3.427095 1.1983875 7.20980906 1.1983875 5.78733281 0 6.20140969 0.146145 6.21602437 2.16050718 0.02679281 4.07013187 1.43465438 4.94943656 8.56895532 5.35377 6.70560938 0.37754063 6.77381063 0.40920562 6.77381062 3.09826875 0 3.48555281 0.57970781 3.78514969 8.58844125 4.45741594 6.62279438 0.55534969 6.67150875 0.57970781 6.96136313 3.54401063 0.20947406 2.16781406 0.81597469 3.03493969 2.20922156 3.17134218 13.19930906 1.28850937 12.82663969 1.16185125 13.14328687 4.43549344l0.29472563 3.05686219 7.3851825 0.28011094 7.38274687 0.27767437 0.29472563 3.56106094 0.29716125 3.56106187 7.43876906 0.28011c7.41197625 0.28011094 7.43876906 0.28985344 7.43876906 2.9277675 0 4.03846688 1.62951469 4.95187219 8.83201594 4.95187219 6.26961094 0 6.52780031 0.09012281 6.52780031 2.33100938 0 3.97270219 2.36023781 5.34646312 9.187635 5.34646312 5.75323313 0 6.16974563 0.146145 6.18435938 2.16050625 0.02679281 3.96295875 1.45901156 4.92020719 7.99655531 5.33672063l6.22333125 0.39459093 0.32151844 24.70577438c0.34587562 26.47656187 0.60893625 27.87711656 5.23929094 27.87711562 2.20191469 0 2.28229406 0.25575375 2.28229406 7.229295 0 8.52267656 1.761045 13.511085 5.23198312 14.83125938 2.0630775 0.78431062 2.447925 1.53451969 2.447925 4.79354906 0 2.60868469 0.42138375 3.86309344 1.29825282 3.86309344 2.93507437 0 6.37921969 4.59625312 6.37921875 8.51293312 0 5.69964656 0.73072406 6.8444475 4.3648575 6.84444657 3.00327563 0 3.21762094 0.2192175 3.49773187 3.60003375 0.28254656 3.40273781 0.49202062 3.6146475 3.89719406 3.89719406 3.5001675 0.28985344 3.60003281 0.40189781 3.60003282 4.07987437 0 3.77297063 0.00974344 3.78027844 3.83873625 3.78027844h3.84117187v3.84117188c0 3.82899281 0.00974344 3.83873625 3.78027844 3.83873625 3.67797656 0 3.79002094 0.09986531 4.07987437 3.60003281 0.28254656 3.40760906 0.49932844 3.62439 4.09936125 4.07987531 3.07878375 0.38971969 3.90693656 0.93532688 4.35755063 2.87905219 0.63816563 2.740215 5.00545875 4.65958219 10.80009844 4.74483375 3.07147594 0.04627875 3.60003281 0.37023375 3.61221187 2.21409281 0.031665 4.48664438 1.21787344 5.02007344 11.94977156 5.36838469 9.19981406 0.29716125 10.11321844 0.49202062 10.11321844 2.15807156 0 1.78053094 1.4273475 1.83411656 49.43590594 1.83411656 47.61396844 0 49.43590594-0.06576469 49.43590687-1.79270906 0-1.59784969 1.03275656-1.84142437 9.56030344-2.25062906 9.9792525-0.48227813 12.19090969-1.33478906 12.69754594-4.90559344 0.23870344-1.66361437 1.04493469-2.15319938 3.94590844-2.39190281 2.70611437-0.22165313 3.85335094-0.84276844 4.44767343-2.39920969 1.38350344-3.6146475 4.16269031-5.31967031 9.19007063-5.6363175 4.65958219-0.29472562 4.81790625-0.40189781 5.68259531-3.90206531 0.79648875-3.2298 1.20569437-3.60003281 3.97513875-3.60003281 3.26146406 0 4.25524875-1.2495375 4.25524875-5.35864219 0-1.99731188 0.45061313-2.32126594 3.25659281-2.32126594 3.43927406 0 4.42087969-1.18864406 4.42087875-5.35620562 0-2.01192656 0.4481775-2.32126594 3.34915125-2.32126688 3.16403437 0 3.38081625-0.21190969 3.96295969-3.84117187 0.50419969-3.15916313 0.99622031-3.83873625 2.77187906-3.83873625 3.15429187 0 4.04577469-1.64412844 4.81303407-8.87829469l0.68444531-6.479085h3.249285c2.93263875 0 3.24684938-0.26549625 3.24685031-2.74752188 0-8.64446344 1.07172844-11.58440906 4.4476725-12.22013906l3.23223563-0.604065v-21.61968375l3.83873625-0.61380844 3.84117187-0.61380843v-35.2915275c0-38.3751825-0.15832313-39.55895531-5.30262-39.55895532-2.2920375 0-2.31639469-0.10230094-2.58676219-10.79766281l-0.27036843-10.80009937-3.05442563-0.89879063c-3.3223575-0.97917-4.10179688-2.61842719-4.14564-8.70048562-0.03410062-4.72291219-0.74046656-5.906685-4.01898187-6.72996657-2.0630775-0.51637781-2.68419281-1.37132531-3.19326282-4.39408593-0.5943225-3.50747437-0.85007531-3.75348469-3.90937312-3.75348563-3.08121937 0-3.27607875-0.19242375-3.27607875-3.24441375 0-2.48202562-0.896355-4.16756156-3.81681469-7.17814406-2.10204937-2.16294281-4.44280125-5.4268425-5.20518937-7.25365313-1.11557156-2.66957813-2.20191469-3.55375406-5.5413225-4.50613031-4.78380562-1.36645406-7.3851825-3.30287156-8.56164844-6.3743475-0.64060125-1.67579344-1.58567062-2.16050719-4.20896906-2.16050719-3.06416906 0-3.38325188-0.25331719-3.38325188-2.68662843 0-3.48311719-1.59054187-4.99327969-5.2612125-4.99327969-2.35536656 0-3.16159875-0.54560719-3.96783-2.67932063-1.09852125-2.90828063-6.05770125-4.99815094-11.86208437-4.99815187-2.12884219 0-3.67554094-0.718545-4.90072219-2.27985844-3.23710687-4.11153937-7.52889188-5.40004969-18.00747188-5.40004969h-9.63337687l-0.29959594-3.12019031c-0.38971969-4.01898094-2.72316469-4.33562813-33.03846281-4.46472281-25.77263156-0.10960875-33.89828062 0.50176406-34.70938406 2.61842719-1.49311219 3.89475844-3.91424438 4.96648688-11.2190475 4.96648593-11.0412375 0-16.80908531 1.53208406-17.93683594 4.76431969-0.82815375 2.37241688-1.50529125 2.71098563-6.47421375 3.23223563-7.50209812 0.78431062-8.75894344 1.39081125-9.38980125 4.55241-0.46035562 2.29690875-1.06929281 2.7499575-4.03116094 2.99840343-3.27851437 0.27280313-3.50747437 0.50907094-3.78758531 3.88988719-0.27767531 3.34428-0.51637781 3.60003281-3.36132938 3.60490406-6.25743187 0.01217906-10.28372063 1.79758031-10.89022218 4.82764969-0.45304875 2.26524375-1.19107969 2.92045969-3.83142844 3.41735156-3.40030219 0.63816563-5.13698906 2.69393531-5.13698906 6.08692969 0 1.44683344-0.61624406 1.98269719-2.28229407 1.98269813-2.93020313 0-4.10179688 1.47606187-4.94943656 6.23794593-1.09608562 6.14295188-3.60734062 8.15974969-10.15706156 8.15974969h-5.53401563l-0.29716125-3.60003281-0.29716125-3.60003281-7.3851825-0.27767532-7.38274687-0.28011093-0.29472563-3.56106094-0.29716125-3.55862531-7.43876906-0.28254657-7.43876906-0.28011093v-3.21518532c0-3.90206531-1.010835-4.38190781-9.1973775-4.38190687h-6.16243781v-3.24928594c0-3.8022-1.3128675-4.39652156-9.77708625-4.41844312-5.43902156-0.01217906-5.4585075-0.02192156-5.76054-3.09339844-0.34587562-3.55862531-2.12640656-4.35024281-10.13757563-4.50125906-4.91533594-0.09499406-5.03955938-0.16563094-5.03955937-2.92045969 0-3.58054688-0.28498219-3.7291275-8.52024-4.49638781-6.24768938-0.57970781-6.83957531-0.82084687-6.83957532-2.77918594 0-3.15916313-1.76835188-4.13102531-8.82470906-4.8544425-5.94322125-0.60893625-6.37678406-0.81597469-6.87124031-3.29069344-0.56996437-2.85713062-1.54426313-3.28338563-10.05476063-4.39408594-4.09692562-0.53342813-5.27826188-1.09852125-5.94078468-2.83764468-0.91584094-2.41138875-4.48177313-3.80707125-12.22257563-4.78380563l-5.03955844-0.63573v-3.63900469c0-2.83033688 0.42625594-3.74861344 1.91936813-4.13833312 1.77322312-0.46522781 1.91936813-1.31043187 1.91936812-11.03393063v-10.53216656l20.58205594-0.39702656c21.99966-0.42625594 24.53283656-1.0205775 24.53283656-5.74592531 0-1.65874312 1.19107969-1.77322312 18.9574125-1.82680969 24.48168563-0.07063688 26.5423275-0.4165125 26.93935407-4.51343813l0.29959687-3.11044781h43.21501031l3.44658094-3.83873625 3.44658094-3.83873625 19.76121-0.05602219c25.07113594-0.07063688 27.1463925-0.39946219 28.35939375-4.50856687l0.91827656-3.11531906h21.32008688c21.67327031 0 24.35746312-0.25818937 24.35746312-2.33588063 0-4.55971688 3.49042406-5.3440275 23.79967594-5.3440275 21.5319975 0 26.56181344-0.97917 27.6676425-5.385435l0.57483562-2.2920375h21.90466688c23.77288406 0 24.92255625-0.24844594 24.92255531-5.34889875v-2.33100844h43.83369l3.08609063-3.84117187 3.08609062-3.83873625h21.49058906c23.75096156 0 25.92364781-0.38241188 26.88089625-4.74239813l0.6454725-2.93751h22.88383688v2.32126594c0 4.16999719 0.98160562 5.35864219 4.42331531 5.35864219h3.25659281v6.17218031c0 6.79816781 1.37376094 9.187635 5.29044 9.187635 1.93398281 0 2.31639469 0.53586375 2.56971282 3.59759719 0.28254656 3.39299437 0.50176406 3.61708313 3.8436075 3.89475844 3.33210094 0.27767531 3.56349656 0.50907094 3.83873625 3.84117187 0.27767531 3.33940781 0.50176406 3.56106094 3.89475843 3.84117188 3.38081625 0.28011094 3.60003281 0.49445625 3.60003282 3.49773187 0 3.37837969 1.21056562 4.3648575 5.35864218 4.3648575 1.76348062 0 2.32370156 0.51881437 2.33588063 2.15807156 0.02435719 3.80463562 1.34940375 4.6254825 8.41550344 5.21736844 6.77381063 0.56752875 6.82739719 0.59675813 7.11725062 3.51965344 0.35074781 3.56349656 2.16781406 4.23089156 11.91567 4.36729219 7.07097187 0.09742969 7.572735 0.36779812 10.93650094 5.85553406 0.75264562 1.22274469 5.60952375 1.47849844 32.35645406 1.70258719 35.01628875 0.29229 39.11321344-0.18998813 41.3638425-4.86174938 1.14236531-2.3748525 1.72938-2.60137688 6.72022406-2.61355594 8.47152562-0.02192156 9.78682875-0.61380844 9.78682875-4.41844406v-3.249285h5.82143344c7.29749625 0 9.53594625-1.12044375 9.53594719-4.77406312 0-2.52830438 0.3336975-2.81572312 3.60003281-3.08609063 3.39299437-0.28011094 3.61708313-0.50176406 3.89475844-3.8436075 0.27523969-3.32966531 0.50907094-3.56106094 3.83873625-3.83873625 3.33210094-0.27767531 3.56349656-0.50907094 3.83873531-3.83873625 0.27767531-3.33210094 0.50907094-3.56349656 3.84117188-3.84117187 3.32966531-0.27523969 3.56106094-0.50907094 3.83873625-3.83873625 0.27767531-3.33210094 0.50907094-3.56349656 3.84117187-3.84117188l3.54401156-0.29472469 0.29716032-5.26608375c0.31421156-5.55593719 1.89257531-8.24013 5.70208218-9.69670593 1.97539031-0.75508125 2.16050719-1.44439781 2.16050719-8.05014094 0-6.5838225 0.16806656-7.22198813 1.91936813-7.22198813 1.89257531 0 1.91936813-0.64060125 1.91936812-45.1148925 0-44.47672688-0.02679281-45.11732813-1.91936812-45.11732812-1.66361437 0-1.93398281-0.66983062-2.01679782-5.03955938-0.15101625-8.01116906-0.94019812-9.7917-4.50125906-10.14001125-2.87905219-0.28011094-3.08121937-0.54073594-3.08121937-3.97513781 0-3.88745062-1.05467812-4.84226344-5.35864219-4.84226437-1.99244062 0-2.32126594-0.45304875-2.32126594-3.21518438 0-5.37812812-1.76591625-9.02200406-4.9055925-10.11565406a6.14051625 6.14051625 0 0 1-3.83873625-3.84117188c-1.125315-3.22492781-4.75457719-4.90559344-10.59549656-4.90559343-3.67310531 0-3.6974625-0.02435719-3.6974625-3.83873625v-3.84117188h-3.83873625c-3.427095 0-3.84117187-0.25088156-3.84117188-2.33100937 0-3.95078062-2.36511-5.34646312-9.06584812-5.34646313-5.96270719 0-6.06013688-0.04384313-6.63010125-2.89610156-0.94019812-4.698555-2.22383625-4.8227775-48.84889125-4.76431969-23.76314062 0.031665-43.26129-0.06820125-43.32461906-0.22165312-1.03519219-2.44061812-2.58189094-4.29422063-4.20653344-5.03468813-1.18133719-0.54073594-2.24819344-2.18242875-2.58676313-3.98244469-0.63085875-3.36863719-1.92180375-4.78867688-4.84469906-5.32454156-1.18620844-0.2192175-2.04602719-1.26658781-2.25063-2.74508625-0.45061313-3.23710687-1.6879725-4.55241-4.95917906-5.270955-2.23845094-0.49202062-2.81085094-1.17890156-3.05199-3.66092625-0.24601031-2.54291906-0.85981875-3.23710687-3.656055-4.1358975-2.66470687-0.85494656-3.427095-1.64900062-3.68528438-3.83629969-0.36536156-3.07634719-1.56374906-4.16756156-4.60599656-4.18948406-1.57105594-0.00974344-2.19704344-0.781875-2.66714156-3.28095-0.61380844-3.27851437-2.01192656-4.41113625-5.43902156-4.41113625-1.37619656 0-1.84142437-0.67957313-1.84142438-2.68906406 0-3.41004469-1.58079938-4.99084406-4.99084406-4.99084406-2.30421562 0-2.68662844-0.3848475-2.68662844-2.68662844 0-3.41248031-1.58079938-4.99327969-4.99327969-4.99327969-2.41382438 0-2.68662844-0.32882531-2.6866275-3.25659281 0-3.43927406-1.18864406-4.42087969-5.35864218-4.42087969-1.99731188 0-2.32126594-0.45304875-2.32126594-3.25902844 0-3.43927406-1.18864406-4.42087969-5.35620656-4.42087968-2.01192656 0-2.32126594-0.4481775-2.32126594-3.34915125 0-3.16403437-0.21190969-3.38081625-3.84117188-3.96052313-3.51965344-0.56509312-3.84117187-0.86469-3.86552906-3.61221187-0.01948594-2.42113219-0.72341625-3.427095-3.66092719-5.23685438-2.83764469-1.74886594-3.89232281-3.19326375-4.79598468-6.57164344-0.91827656-3.43927406-1.75130156-4.55241-4.04577375-5.41953562-1.95834-0.74046656-3.1250625-1.9997475-3.61951969-3.90937219-0.71367375-2.75239313-1.78783781-3.74130656-5.21006063-4.79842031-1.00352719-0.30933937-1.67822906-1.468755-1.67822906-2.87905219a5.3123625 5.3123625 0 0 0-5.34889969-5.37812812c-1.91206125 0-2.33100937-0.48227813-2.33100843-2.68906407 0-3.39299437-1.57836375-4.99084406-4.93238625-4.99084406-2.34805969 0-2.66227031-0.38728406-2.9277675-3.60003281-0.28254656-3.39299437-0.50176406-3.61708313-3.8436075-3.89475844-3.33210094-0.27523969-3.56349656-0.50907094-3.83873625-3.83873625-0.26549625-3.18108469-0.59919375-3.57567563-3.25902844-3.83386406-2.53074-0.24601031-3.08852625-0.80623219-3.83873625-3.83873625-0.76238812-3.08609063-1.28607375-3.59029031-3.99705938-3.85335094-2.55022594-0.24601031-3.12019125-0.71123813-3.12019125-2.55996937 0-4.1042325-0.99378469-5.29774781-4.42087875-5.29774782-2.80597969 0-3.25659281-0.32151844-3.25659281-2.32126593 0-4.14807562-0.98647687-5.35864219-4.3648575-5.35864219-3.00327563 0-3.21762094-0.2192175-3.49773187-3.59759719-0.26306062-3.19326375-0.62355094-3.64387687-3.17621344-3.98000906-2.82790125-0.375105-2.83520906-0.39215531-0.48227719-0.99378469 2.16781406-0.55534969 2.48689688-1.28850937 3.28338563-7.53863437 0.85981875-6.73240313 0.95968406-6.9272625 3.56593218-6.9272625 3.51721781 0 4.67176125-2.30665219 4.67176219-9.33621563 0-5.51452969 0.05845781-5.64118875 3.11288344-6.542415 3.833865-1.13018625 4.43062219-3.69502687 4.51100156-19.42020469 0.05358656-10.65882563 0.09012281-10.83663562 2.47228313-11.74273312 3.33940781-1.26902344 4.12858969-3.98488125 4.7911125-16.50218063 0.95237719-18.03913688-0.24357469-25.89928969-4.08961782-26.89551093l-3.12019125-0.80623125v-13.33083938c0-15.61800469-0.13153031-16.12707562-4.41113625-16.93087219l-3.26633531-0.61380843-0.00243656-6.85175438c-0.00243562-7.96976156-2.14102125-13.39904063-5.46581438-13.87157531-1.72938-0.24601031-2.16050719-1.0205775-2.39920968-4.31857781-0.28254656-3.86552906-0.42625594-4.03116-3.77540719-4.31127094-3.41735156-0.28498219-3.49042406-0.37754063-3.93373031-4.98597281-0.51637781-5.39030625-2.88392344-9.60171187-5.3951775-9.60171188-1.1983875 0-1.9997475-1.10095687-2.61842719-3.60003281-0.71123813-2.88392344-1.49067656-3.77784281-3.91911563-4.49151563-2.21652937-0.65521594-3.25415719-1.68553687-3.86309437-3.84117187-0.69418781-2.45523187-1.50529125-3.09583312-4.88123531-3.84847969-2.59407-0.57727219-4.25524875-1.54913437-4.62061032-2.69880656-0.31177594-0.98647687-1.61246438-2.27011594-2.88636-2.84982375-1.27389562-0.58214344-2.31639469-1.41760406-2.31639468-1.86090938 0-0.44330625-1.70015063-0.80623219-3.7802775-0.80623218-3.67797656 0-3.79002094-0.09986531-4.07987532-3.60003282l-0.29716125-3.60003375-7.3851825-0.28011-7.38274687-0.27767531-0.29716125-3.56106094-0.29472469-3.56106093-7.43877-0.28011094c-6.64958719-0.25088156-7.43876906-0.47984156-7.43876906-2.15807156 0-1.84386-1.01814187-1.88039625-52.79479969-1.88039625s-52.79480063 0.03653625-52.79480062 1.88039625m15.74466375 278.86371937c1.16915813 4.64983969 2.53804781 4.82521312 37.52997843 4.82521313 35.19653344 0 36.95514281-0.22896 36.95514282-4.83252v-2.36511h23.9994075v3.38325187c0 2.70611437 0.47009906 3.56106094 2.34805968 4.27717031 2.82303 1.07172844 5.0834025 4.29909188 5.91155625 8.44473282 0.66495844 3.32722969 1.81463062 4.62061031 4.57433157 5.14916718 1.05711375 0.20216719 2.24088656 1.72207219 2.87905218 3.70233469 0.82571813 2.55753375 1.82924531 3.57811125 4.20409782 4.27717031 2.51125406 0.74046656 3.12019125 1.42003969 3.12019125 3.48311719 0 2.96430281 1.41273281 4.39895813 4.79842031 4.86662063 1.92180375 0.26549625 2.49420375 0.99865594 2.87905125 3.69259125 0.41894813 2.92533094 0.86225438 3.39543 3.44414531 3.64874812 2.53074 0.24601031 3.08852625 0.80379656 3.83873625 3.83873625 0.76238812 3.083655 1.28607375 3.59029031 3.99706031 3.85091438 2.55022594 0.24601031 3.12019125 0.71367375 3.12019032 2.56240593 0 4.08474656 0.99865594 5.29531219 4.36242187 5.29531219 3.00571125 0 3.21762094 0.22165313 3.49773188 3.60003281 0.28011094 3.39299437 0.50176406 3.61708313 3.8436075 3.89475844 3.32966531 0.27767531 3.56349656 0.50907094 3.83873625 3.83873625 0.27767531 3.33210094 0.50907094 3.56349656 3.84117187 3.84117188 3.32966531 0.27523969 3.56106094 0.50907094 3.83873625 3.83873625 0.27767531 3.32966531 0.50907094 3.56349656 3.83873531 3.83873531 3.33210094 0.27767531 3.56349656 0.50907094 3.84117188 3.84117187 0.27767531 3.34184344 0.49932844 3.56106094 3.89232281 3.84117188 3.5001675 0.28985344 3.60003281 0.40433344 3.60003281 4.07987531 0 2.90828063 0.375105 3.78271406 1.61977125 3.78271406 2.20191469 0 6.06013688 3.77297063 6.06013688 5.92617094 0 0.96455531 0.40189781 1.75373719 0.89391937 1.75373719 0.49445625 0 1.16428687 0.84033281 1.49067657 1.87065281 0.32638969 1.02788531 1.46631937 2.1458925 2.53561125 2.48689688 1.06929281 0.33856875 2.73290719 2.46010406 3.70233468 4.72047656 1.17159375 2.73290719 2.52343312 4.29909188 4.04090344 4.67906906 1.51990594 0.38241188 2.58676219 1.62220688 3.2078775 3.72669094 0.69905906 2.37972375 1.69040813 3.37837969 4.04577469 4.07256844 2.30421562 0.6771375 3.12019125 1.47362625 3.12019125 3.03981093 0 3.94347281 1.03032094 5.15891062 4.36485656 5.15891063 3.00327563 0 3.21762094 0.22165313 3.49773188 3.60003281 0.27280313 3.30774375 0.56996437 3.63900469 3.656055 4.07987531 2.98622531 0.42625594 3.41248031 0.85251094 3.84117187 3.83873625 0.41894813 2.94968906 0.85007531 3.39543 3.52452563 3.656055 2.72316469 0.26306062 3.11044781 0.69175219 3.68284781 4.07987532 0.59919375 3.541575 0.85007531 3.78271406 3.91424437 3.78271406 2.82546563 0 3.27607875 0.32151844 3.27607875 2.32126594 0 4.14807562 0.98404125 5.35864219 4.3648575 5.35864125 3.00327563 0 3.21518531 0.2192175 3.49529532 3.60003375 0.28011094 3.3856875 0.50907094 3.61708313 3.8022 3.89232187 4.09448906 0.34100438 4.406265 1.57592812 3.86309437 15.30622969-0.29229 7.38761812-0.45304875 7.91861156-2.39921062 7.93322625-3.99462375 0.02922938-4.87879969 1.46631937-5.2806975 8.56895531l-0.38241282 6.77380969-18.37039781 0.05602219c-20.41398937 0.05845781-24.66193125 0.84763969-25.5729 4.74483375l-0.56022187 2.39921062-22.51603875 0.54317156c-12.38333438 0.29716125-22.603725 0.62111531-22.71089813 0.718545-0.10960875 0.09742969-0.48227813 1.69040813-0.82815375 3.53913938l-0.63085875 3.35889375-21.7292925 0.00487125c-24.65462344 0.00730688-28.28145 0.59188594-29.75507625 4.81547062l-0.99622031 2.85956625H609.02829219c-23.92390031 0-23.85569906-0.01217906-24.68385282 4.39408594l-0.60893625 3.24928594-22.21400625 0.25818937-22.21400625 0.25575282-0.29472468 3.541575-0.29472563 3.541575-24.75692531 0.29716125c-26.52284156 0.32151844-27.92826656 0.58214344-27.92826656 5.20031812v2.26280906l-22.78884188 0.25818844-22.78884187 0.25818938-0.49445719 2.87905218c-0.59919375 3.5001675-4.22114813 4.00923844-29.85737719 4.19922657-17.47404375 0.13153031-21.67570594 0.97673437-22.56962531 4.53535968-0.57483656 2.28960187-0.66495844 2.30421562-14.15412188 2.41138875-7.46556187 0.05845781-17.67621094 0.38241188-22.69384781 0.72098063l-9.11699812 0.61137281-0.3020325 3.12019031-0.29959688 3.12019125h-18.10003031c-9.95489531 0-18.78203906 0.260625-19.61750063 0.58214344-1.2495375 0.47984156-1.51747031-0.20216719-1.51747031-3.83873625v-4.42331531h7.67990813v-3.83873625c0-3.56593219 0.18998813-3.84117187 2.68662843-3.84117188 3.78027844 0 4.99084406-1.62951469 4.99084407-6.7177875 0-4.11153937 0.26306062-4.57676719 3.81437812-6.76650375 3.12993375-1.93154719 3.81925031-2.89853812 3.83873625-5.38787062 0.02435719-2.78892937 0.34100438-3.08852625 3.86552906-3.68528438 3.59759719-0.60650063 3.84117187-0.85251094 3.84117188-3.90450093 0-2.77431469 0.39215531-3.34428 2.63791406-3.83630063 4.78867688-1.04980688 5.03955938-1.28363812 5.03955844-4.7082975 0-2.25306563 0.4481775-3.38812312 1.33478906-3.38812312 3.20300625 0 5.47312219-3.31992187 6.04065094-8.82958032l0.5626575-5.46825 3.47093812-0.28985437c3.25659281-0.27280313 3.48798844-0.51394219 3.76809938-3.88988625 0.26549625-3.21274969 0.58214344-3.60003281 2.9277675-3.60003281 3.34671562 0 4.93482187-1.59541406 4.93482187-4.96405125 0-2.19460781 0.54317156-2.80110844 3.10557657-3.46606688 2.80841531-0.72828844 3.18352031-1.25928094 3.90206531-5.53888687 0.84763969-5.06148094 2.7182925-7.82848875 6.18923156-9.15597 1.67579344-0.64060125 2.16050719-1.58567062 2.16050625-4.20897 0-3.22492781 0.15832313-3.38325188 3.34915125-3.38325188 3.1567275 0 3.38325188-0.21678187 3.95321625-3.78758531 0.54073594-3.3856875 0.92314781-3.81925031 3.60977625-4.07987438 2.72072812-0.26306062 3.03493969-0.63573 3.30530813-3.89719406 0.23383125-2.8327725 0.87930469-3.90693656 3.020325-5.01276656 2.66957813-1.38106781 5.79951188-7.96245469 5.79951187-12.19090969 0-1.35914625 0.75021-1.74886594 3.35889375-1.74886594 3.2712075 0 3.36133031-0.09986531 3.36133031-3.78271406 0-3.67554094 0.09986531-3.79002094 3.60003282-4.07743875 3.38081625-0.28011094 3.61708313-0.50907094 3.88988718-3.79002187 0.25088156-3.00571125 0.68444437-3.56836875 3.134805-4.05795282 3.35158687-0.66983062 4.73265469-3.52939594 4.73265469-9.7917 0-3.86309344 0.21434531-4.25768438 2.32126688-4.25768437 4.12615406 0 5.35864219-0.98891344 5.35864125-4.29909281 0-2.91315281 0.26793187-3.17621344 3.83873625-3.74861344 3.60977625-0.57727219 3.84117187-0.81110344 3.84117187-3.885015 0-2.91315281 0.34100438-3.34671562 3.11775563-3.948345 3.70720594-0.80623219 4.52561625-1.84873125 4.54510218-5.79464063 0.01217906-2.15807156 0.66008719-3.30043594 2.39921063-4.23332625 1.31043187-0.70149469 2.6354775-2.07038438 2.94481687-3.03981187 0.30690375-0.97186312 0.96211969-1.76835188 1.45414032-1.76835188 0.49445625 0 0.896355-1.70015063 0.896355-3.7802775 0-3.67797656 0.09986531-3.79002094 3.60003281-4.07987531 3.40273781-0.28254656 3.6146475-0.49445625 3.89719406-3.89719406 0.2703675-3.26633531 0.55778625-3.60003281 3.08609063-3.60003281 3.06173344 0 4.77406313-2.17268531 4.77406218-6.05526563 0-1.82680969 0.62598656-2.46984656 2.82546563-2.90828062 3.05442562-0.61137188 4.83739219-4.61817469 4.84957125-10.89752907 0.00487125-2.84251594 0.260625-3.08121937 3.60490406-3.35889468 3.40517344-0.28254656 3.6146475-0.49202062 3.89719406-3.89719407 0.28254656-3.40273781 0.47984156-3.60003281 3.58785469-3.60003281 3.09826969 0 3.32722969-0.22652438 3.90450094-3.83873625 0.51150656-3.19569937 0.98647687-3.84117187 2.83520906-3.84117187 2.76457219 0 3.52208906-1.15210781 4.73265469-7.18545094 0.76482469-3.81681469 1.583235-5.18083219 4.02385312-6.72022406 1.87065281-1.17890156 3.31992187-3.05199 3.719385-4.81059938 0.75021-3.28825781 1.90231781-4.28447812 4.97622938-4.30639875 1.82437406-0.01217906 2.16050719-0.53342813 2.16050719-3.37350844 0-4.47690188 7.93078969-5.3440275 9.02443968-0.98647781" fill="#bfbfbf" p-id="11188"></path></svg>
\ No newline at end of file
diff --git a/web/src/assets/svg/rerun.svg b/web/src/assets/svg/rerun.svg
new file mode 100644
index 0000000000..cd972f4e6c
--- /dev/null
+++ b/web/src/assets/svg/rerun.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1757483419289" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22299" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M998.765714 523.629714c13.824 0 25.014857 11.190857 25.014857 25.014857a475.282286 475.282286 0 0 1-875.593142 256.219429l-27.574858 55.149714a25.014857 25.014857 0 1 1-44.763428-22.454857l44.178286-88.283428a24.868571 24.868571 0 0 1 26.550857-25.526858 25.014857 25.014857 0 0 1 8.265143 0.804572l99.474285 24.868571a25.014857 25.014857 0 0 1-12.068571 48.566857l-46.372572-11.556571A425.252571 425.252571 0 0 0 973.750857 548.571429c0-13.897143 11.190857-25.014857 25.014857-25.014858zM430.957714 365.714286l6.729143 0.658285c2.633143 0.438857 285.549714 160.109714 285.549714 160.109715 20.114286 17.846857 7.314286 34.523429-6.582857 45.933714-1.828571 1.462857-194.779429 113.078857-249.929143 144.969143l-10.678857 6.217143-3.876571 2.194285c-16.676571 8.923429-39.497143 8.923429-47.250286-11.995428-0.877714-2.194286-2.267429-250.221714-2.56-303.396572L402.285714 400.457143l0.731429-0.512c0.731429-18.651429 8.265143-38.034286 34.669714-33.645714z m-15.945143-273.408a475.282286 475.282286 0 0 1 533.869715 200.045714l27.501714-55.149714a25.014857 25.014857 0 1 1 44.690286 22.454857l-44.105143 88.283428a24.868571 24.868571 0 0 1-26.624 25.526858 24.868571 24.868571 0 0 1-8.192-0.804572l-99.547429-24.868571a25.014857 25.014857 0 0 1 12.068572-48.566857l46.445714 11.629714A425.252571 425.252571 0 0 0 123.245714 548.571429a25.014857 25.014857 0 0 1-50.029714 0 475.282286 475.282286 0 0 1 341.796571-456.265143z" fill="#3BA05C" p-id="22300"></path></svg>
\ No newline at end of file
diff --git a/web/src/components/file-status-badge.tsx b/web/src/components/file-status-badge.tsx
new file mode 100644
index 0000000000..ad681eb34e
--- /dev/null
+++ b/web/src/components/file-status-badge.tsx
@@ -0,0 +1,57 @@
+// src/pages/dataset/file-logs/file-status-badge.tsx
+import { FC } from 'react';
+
+interface StatusBadgeProps {
+ status: 'Success' | 'Failed' | 'Running' | 'Pending';
+}
+
+const FileStatusBadge: FC<StatusBadgeProps> = ({ status }) => {
+ const getStatusColor = () => {
+ // #3ba05c → rgb(59, 160, 92) // state-success
+ // #d8494b → rgb(216, 73, 75) // state-error
+ // #00beb4 → rgb(0, 190, 180) // accent-primary
+ // #faad14 → rgb(250, 173, 20) // state-warning
+ switch (status) {
+ case 'Success':
+ return `bg-[rgba(59,160,92,0.1)] text-state-success`;
+ case 'Failed':
+ return `bg-[rgba(216,73,75,0.1)] text-state-error`;
+ case 'Running':
+ return `bg-[rgba(0,190,180,0.1)] text-accent-primary`;
+ case 'Pending':
+ return `bg-[rgba(250,173,20,0.1)] text-state-warning`;
+ default:
+ return 'bg-gray-500/10 text-white';
+ }
+ };
+
+ const getBgStatusColor = () => {
+ // #3ba05c → rgb(59, 160, 92) // state-success
+ // #d8494b → rgb(216, 73, 75) // state-error
+ // #00beb4 → rgb(0, 190, 180) // accent-primary
+ // #faad14 → rgb(250, 173, 20) // state-warning
+ switch (status) {
+ case 'Success':
+ return `bg-[rgba(59,160,92,1)] text-state-success`;
+ case 'Failed':
+ return `bg-[rgba(216,73,75,1)] text-state-error`;
+ case 'Running':
+ return `bg-[rgba(0,190,180,1)] text-accent-primary`;
+ case 'Pending':
+ return `bg-[rgba(250,173,20,1)] text-state-warning`;
+ default:
+ return 'bg-gray-500/10 text-white';
+ }
+ };
+
+ return (
+ <span
+ className={`inline-flex items-center w-[75px] px-2 py-1 rounded-full text-xs font-medium ${getStatusColor(0.1)}`}
+ >
+ <div className={`w-1 h-1 mr-1 rounded-full ${getBgStatusColor()}`}></div>
+ {status}
+ </span>
+ );
+};
+
+export default FileStatusBadge;
diff --git a/web/src/components/originui/timeline.tsx b/web/src/components/originui/timeline.tsx
index befe5272ec..57694ee3b9 100644
--- a/web/src/components/originui/timeline.tsx
+++ b/web/src/components/originui/timeline.tsx
@@ -1,6 +1,7 @@
'use client';
import { cn } from '@/lib/utils';
+import { parseColorToRGBA } from '@/utils/common-util';
import { Slot } from '@radix-ui/react-slot';
import * as React from 'react';
@@ -197,7 +198,208 @@ function TimelineTitle({
);
}
+interface TimelineIndicatorNodeProps {
+ nodeSize?: string | number;
+ iconColor?: string;
+ lineColor?: string;
+ textColor?: string;
+ indicatorBgColor?: string;
+ indicatorBorderColor?: string;
+}
+interface TimelineNode
+ extends Omit<
+ React.HTMLAttributes<HTMLDivElement>,
+ 'id' | 'title' | 'content'
+ >,
+ TimelineIndicatorNodeProps {
+ id: string | number;
+ title?: React.ReactNode;
+ content?: React.ReactNode;
+ date?: React.ReactNode;
+ icon?: React.ReactNode;
+ completed?: boolean;
+ clickable?: boolean;
+ activeStyle?: TimelineIndicatorNodeProps;
+}
+
+interface CustomTimelineProps extends React.HTMLAttributes<HTMLDivElement> {
+ nodes: TimelineNode[];
+ activeStep?: number;
+ nodeSize?: string | number;
+ onStepChange?: (step: number, id: string | number) => void;
+ orientation?: 'horizontal' | 'vertical';
+ lineStyle?: 'solid' | 'dashed';
+ lineColor?: string;
+ indicatorColor?: string;
+ defaultValue?: number;
+ activeStyle?: TimelineIndicatorNodeProps;
+}
+
+const CustomTimeline = ({
+ nodes,
+ activeStep,
+ nodeSize = 12,
+ onStepChange,
+ orientation = 'horizontal',
+ lineStyle = 'solid',
+ lineColor = 'var(--text-secondary)',
+ indicatorColor = 'var(--accent-primary)',
+ defaultValue = 1,
+ className,
+ activeStyle,
+ ...props
+}: CustomTimelineProps) => {
+ const [internalActiveStep, setInternalActiveStep] =
+ React.useState(defaultValue);
+ const _lineColor = `rgb(${parseColorToRGBA(lineColor)})`;
+ console.log(lineColor, _lineColor);
+ const currentActiveStep = activeStep ?? internalActiveStep;
+
+ const handleStepChange = (step: number, id: string | number) => {
+ if (activeStep === undefined) {
+ setInternalActiveStep(step);
+ }
+ onStepChange?.(step, id);
+ };
+ const [r, g, b] = parseColorToRGBA(indicatorColor);
+ return (
+ <Timeline
+ value={currentActiveStep}
+ onValueChange={(step) => handleStepChange(step, nodes[step - 1]?.id)}
+ orientation={orientation}
+ className={className}
+ {...props}
+ >
+ {nodes.map((node, index) => {
+ const step = index + 1;
+ const isCompleted = node.completed ?? step <= currentActiveStep;
+ const isActive = step === currentActiveStep;
+ const isClickable = node.clickable ?? true;
+ const _activeStyle = node.activeStyle ?? (activeStyle || {});
+ const _nodeSizeTemp =
+ isActive && _activeStyle?.nodeSize
+ ? _activeStyle?.nodeSize
+ : node.nodeSize ?? nodeSize;
+ const _nodeSize =
+ typeof _nodeSizeTemp === 'number'
+ ? `${_nodeSizeTemp}px`
+ : _nodeSizeTemp;
+ console.log('icon-size', nodeSize, node.nodeSize, _nodeSize);
+ // const activeStyle = _activeStyle || {};
+
+ return (
+ <TimelineItem
+ key={node.id}
+ step={step}
+ className={cn(
+ node.className,
+ isClickable &&
+ 'cursor-pointer hover:opacity-80 transition-opacity',
+ isCompleted && 'data-[completed]:data-completed/timeline-item',
+ isActive && 'relative z-10',
+ )}
+ onClick={() => isClickable && handleStepChange(step, node.id)}
+ >
+ <TimelineSeparator
+ className={cn(
+ 'group-data-[orientation=horizontal]/timeline:-top-6 group-data-[orientation=horizontal]/timeline:h-0.1 group-data-[orientation=horizontal]/timeline:-translate-y-1/2',
+ 'group-data-[orientation=vertical]/timeline:-left-6 group-data-[orientation=vertical]/timeline:w-0.1 group-data-[orientation=vertical]/timeline:-translate-x-1/2 ',
+ // `group-data-[orientation=horizontal]/timeline:w-[calc(100%-0.5rem-1rem)] group-data-[orientation=vertical]/timeline:h-[calc(100%-1rem-1rem)] group-data-[orientation=vertical]/timeline:translate-y-7 group-data-[orientation=horizontal]/timeline:translate-x-7`,
+ )}
+ style={{
+ border:
+ lineStyle === 'dashed'
+ ? `1px dashed ${isActive ? _activeStyle.lineColor || _lineColor : _lineColor}`
+ : lineStyle === 'solid'
+ ? `1px solid ${isActive ? _activeStyle.lineColor || _lineColor : _lineColor}`
+ : 'none',
+ backgroundColor: 'transparent',
+ width:
+ orientation === 'horizontal'
+ ? `calc(100% - ${_nodeSize} - 2px - 0.1rem)`
+ : '1px',
+ height:
+ orientation === 'vertical'
+ ? `calc(100% - ${_nodeSize} - 2px - 0.1rem)`
+ : '1px',
+ transform: `translate(${
+ orientation === 'horizontal' ? `${_nodeSize}` : '0'
+ }, ${orientation === 'vertical' ? `${_nodeSize}` : '0'})`,
+ }}
+ />
+
+ <TimelineIndicator
+ className={cn(
+ 'flex items-center justify-center p-1',
+ isCompleted && 'bg-primary border-primary',
+ !isCompleted && 'border-text-secondary bg-bg-base',
+ )}
+ style={{
+ width: _nodeSize,
+ height: _nodeSize,
+ borderColor: isActive
+ ? _activeStyle.indicatorBorderColor || indicatorColor
+ : isCompleted
+ ? indicatorColor
+ : '',
+ // backgroundColor: isActive
+ // ? _activeStyle.indicatorBgColor || indicatorColor
+ // : isCompleted
+ // ? indicatorColor
+ // : '',
+ backgroundColor: isActive
+ ? _activeStyle.indicatorBgColor ||
+ `rgba(${r}, ${g}, ${b}, 0.1)`
+ : isCompleted
+ ? `rgba(${r}, ${g}, ${b}, 0.1)`
+ : '',
+ }}
+ >
+ {node.icon && (
+ <div
+ className={cn(
+ 'text-current',
+ `w-[${_nodeSize}] h-[${_nodeSize}]`,
+ isActive &&
+ `text-primary w-[${_activeStyle.nodeSize || _nodeSize}] h-[${_activeStyle.nodeSize || _nodeSize}]`,
+ )}
+ style={{
+ color: isActive ? _activeStyle.iconColor : undefined,
+ }}
+ >
+ {node.icon}
+ </div>
+ )}
+ </TimelineIndicator>
+
+ <TimelineHeader>
+ {node.date && <TimelineDate>{node.date}</TimelineDate>}
+ <TimelineTitle
+ className={cn(
+ 'text-sm font-medium',
+ isActive && _activeStyle.textColor
+ ? `text-${_activeStyle.textColor}`
+ : '',
+ )}
+ style={{
+ color: isActive ? _activeStyle.textColor : undefined,
+ }}
+ >
+ {node.title}
+ </TimelineTitle>
+ </TimelineHeader>
+ {node.content && <TimelineContent>{node.content}</TimelineContent>}
+ </TimelineItem>
+ );
+ })}
+ </Timeline>
+ );
+};
+
+CustomTimeline.displayName = 'CustomTimeline';
+
export {
+ CustomTimeline,
Timeline,
TimelineContent,
TimelineDate,
@@ -206,4 +408,5 @@ export {
TimelineItem,
TimelineSeparator,
TimelineTitle,
+ type TimelineNode,
};
diff --git a/web/src/pages/next-search/spotlight.tsx b/web/src/components/spotlight.tsx
similarity index 56%
rename from web/src/pages/next-search/spotlight.tsx
rename to web/src/components/spotlight.tsx
index 3d9b31f4ae..f5eacbceec 100644
--- a/web/src/pages/next-search/spotlight.tsx
+++ b/web/src/components/spotlight.tsx
@@ -3,10 +3,22 @@ import React from 'react';
interface SpotlightProps {
className?: string;
+ opcity?: number;
+ coverage?: number;
}
-
-const Spotlight: React.FC<SpotlightProps> = ({ className }) => {
+/**
+ *
+ * @param opcity 0~1 default 0.5
+ * @param coverage 0~100 default 60
+ * @returns
+ */
+const Spotlight: React.FC<SpotlightProps> = ({
+ className,
+ opcity = 0.5,
+ coverage = 60,
+}) => {
const isDark = useIsDarkTheme();
+ const rgb = isDark ? '255, 255, 255' : '194, 221, 243';
return (
<div
className={`absolute inset-0 opacity-80 ${className} rounded-lg`}
@@ -18,9 +30,7 @@ const Spotlight: React.FC<SpotlightProps> = ({ className }) => {
<div
className="absolute inset-0"
style={{
- background: isDark
- ? 'radial-gradient(circle at 50% 190%, #fff4 0%, #fff0 60%)'
- : 'radial-gradient(circle at 50% 190%, #E4F3FF 0%, #E4F3FF00 60%)',
+ background: `radial-gradient(circle at 50% 190%, rgba(${rgb},${opcity}) 0%, rgba(${rgb},0) ${coverage}%)`,
pointerEvents: 'none',
}}
></div>
diff --git a/web/src/hooks/logic-hooks/navigate-hooks.ts b/web/src/hooks/logic-hooks/navigate-hooks.ts
index b31e9fb5f4..b403b37ecb 100644
--- a/web/src/hooks/logic-hooks/navigate-hooks.ts
+++ b/web/src/hooks/logic-hooks/navigate-hooks.ts
@@ -125,6 +125,16 @@ export const useNavigatePage = () => {
[navigate],
);
+ const navigateToDataflowResult = useCallback(
+ (id: string, knowledgeId?: string) => () => {
+ navigate(
+ // `${Routes.ParsedResult}/${id}?${QueryStringMap.KnowledgeId}=${knowledgeId}`,
+ `${Routes.DataflowResult}/${id}`,
+ );
+ },
+ [navigate],
+ );
+
return {
navigateToDatasetList,
navigateToDataset,
@@ -144,5 +154,6 @@ export const useNavigatePage = () => {
navigateToFiles,
navigateToAgentList,
navigateToOldProfile,
+ navigateToDataflowResult,
};
};
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index c42e2b693d..997eb1b762 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -102,6 +102,28 @@ export default {
noMoreData: `That's all. Nothing more.`,
},
knowledgeDetails: {
+ generateKnowledgeGraph:
+ 'This will extract entities and relationships from all your documents in this dataset. The process may take a while to complete.',
+ generateRaptor:
+ 'This will extract entities and relationships from all your documents in this dataset. The process may take a while to complete.',
+ generate: 'Generate',
+ raptor: 'Raptor',
+ knowledgeGraph: 'Knowledge Graph',
+ processingType: 'Processing Type',
+ dataPipeline: 'Data Pipeline',
+ operations: 'Operations',
+ status: 'Status',
+ task: 'Task',
+ startDate: 'Start Date',
+ source: 'Source',
+ fileName: 'File Name',
+ datasetLogs: 'Dataset Logs',
+ fileLogs: 'File Logs',
+ overview: 'Overview',
+ success: 'Success',
+ failed: 'Failed',
+ completed: 'Completed',
+ processLog: 'Process Log',
created: 'Created',
learnMore: 'Learn More',
general: 'General',
@@ -195,6 +217,7 @@ export default {
chunk: 'Chunk',
bulk: 'Bulk',
cancel: 'Cancel',
+ close: 'Close',
rerankModel: 'Rerank model',
rerankPlaceholder: 'Please select',
rerankTip: `Optional. If left empty, RAGFlow will use a combination of weighted keyword similarity and weighted vector cosine similarity; if a rerank model is selected, a weighted reranking score will replace the weighted vector cosine similarity. Please be aware that using a rerank model will significantly increase the system's response time. If you wish to use a rerank model, ensure you use a SaaS reranker; if you prefer a locally deployed rerank model, ensure you start RAGFlow with docker-compose-gpu.yml.`,
@@ -238,6 +261,16 @@ export default {
reRankModelWaring: 'Re-rank model is very time consuming.',
},
knowledgeConfiguration: {
+ enableAutoGenerate: 'Enable Auto Generate',
+ teamPlaceholder: 'Please select a team.',
+ dataFlowPlaceholder: 'Please select a data flow.',
+ buildItFromScratch: 'Build it from scratch',
+ useRAPTORToEnhanceRetrieval: 'Use RAPTOR to Enhance Retrieval',
+ extractKnowledgeGraph: 'Extract Knowledge Graph',
+ dataFlow: 'Data Flow',
+ parseType: 'Parse Type',
+ manualSetup: 'Manual Setup',
+ builtIn: 'Built-in',
titleDescription:
'Update your knowledge base configuration here, particularly the chunking method.',
name: 'Knowledge base name',
@@ -1589,5 +1622,11 @@ This delimiter is used to split the input text into several text pieces echo of
total: 'Total {{total}}',
page: '{{page}} /Page',
},
+ dataflowParser: {
+ parseSummary: 'Parse Summary',
+ parseSummaryTip: 'Parser:deepdoc',
+ rerunFromCurrentStep: 'Rerun From Current Step',
+ rerunFromCurrentStepTip: 'Changes detected. Click to re-run.',
+ },
},
};
diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts
index 1f8d9d9ee5..403ff6b456 100644
--- a/web/src/locales/zh.ts
+++ b/web/src/locales/zh.ts
@@ -94,6 +94,24 @@ export default {
noMoreData: '没有更多数据了',
},
knowledgeDetails: {
+ generate: '生成',
+ raptor: 'Raptor',
+ knowledgeGraph: '知识图谱',
+ processingType: '处理类型',
+ dataPipeline: '数据管道',
+ operations: '操作',
+ status: '状态',
+ task: '任务',
+ startDate: '开始时间',
+ source: '来源',
+ fileName: '文件名',
+ datasetLogs: '数据集日志',
+ fileLogs: '文件日志',
+ overview: '概览',
+ success: '成功',
+ failed: '失败',
+ completed: '已完成',
+ processLog: '处理进度日志',
created: '创建于',
learnMore: '了解更多',
general: '通用',
@@ -183,6 +201,7 @@ export default {
chunk: '解析块',
bulk: '批量',
cancel: '取消',
+ close: '关闭',
rerankModel: 'Rerank模型',
rerankPlaceholder: '请选择',
rerankTip: `非必选项:若不选择 rerank 模型,系统将默认采用关键词相似度与向量余弦相似度相结合的混合查询方式;如果设置了 rerank 模型,则混合查询中的向量相似度部分将被 rerank 打分替代。请注意:采用 rerank 模型会非常耗时。如需选用 rerank 模型,建议使用 SaaS 的 rerank 模型服务;如果你倾向使用本地部署的 rerank 模型,请务必确保你使用 docker-compose-gpu.yml 启动 RAGFlow。`,
@@ -227,6 +246,16 @@ export default {
theDocumentBeingParsedCannotBeDeleted: '正在解析的文档不能被删除',
},
knowledgeConfiguration: {
+ enableAutoGenerate: '是否启用自动生成',
+ teamPlaceholder: '请选择团队',
+ dataFlowPlaceholder: '请选择数据流',
+ buildItFromScratch: '去Scratch构建',
+ useRAPTORToEnhanceRetrieval: '使用 RAPTOR 提升检索效果',
+ extractKnowledgeGraph: '知识图谱提取',
+ dataFlow: '数据流',
+ parseType: '切片方法',
+ manualSetup: '手动设置',
+ builtIn: '内置',
titleDescription: '在这里更新您的知识库详细信息,尤其是切片方法。',
name: '知识库名称',
photo: '知识库图片',
@@ -1501,5 +1530,11 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于
total: '总共 {{total}} 条',
page: '{{page}}条/页',
},
+ dataflowParser: {
+ parseSummary: '解析摘要',
+ parseSummaryTip: '解析器: deepdoc',
+ rerunFromCurrentStep: '从当前步骤重新运行',
+ rerunFromCurrentStepTip: '已修改,点击重新运行。',
+ },
},
};
diff --git a/web/src/pages/agent/canvas/index.tsx b/web/src/pages/agent/canvas/index.tsx
index b7c929a52d..74e6d146a7 100644
--- a/web/src/pages/agent/canvas/index.tsx
+++ b/web/src/pages/agent/canvas/index.tsx
@@ -40,6 +40,7 @@ import { useCacheChatLog } from '../hooks/use-cache-chat-log';
import { useMoveNote } from '../hooks/use-move-note';
import { useDropdownManager } from './context';
+import Spotlight from '@/components/spotlight';
import {
useHideFormSheetOnNodeDeletion,
useShowDrawer,
@@ -309,6 +310,7 @@ function AgentCanvas({ drawerVisible, hideDrawer }: IProps) {
onBeforeDelete={handleBeforeDelete}
>
<AgentBackground></AgentBackground>
+ <Spotlight className="z-0" opcity={0.7} coverage={70} />
<Controls position={'bottom-center'} orientation="horizontal">
<ControlButton>
<Tooltip>
diff --git a/web/src/pages/dataflow-result/chunker.tsx b/web/src/pages/dataflow-result/chunker.tsx
new file mode 100644
index 0000000000..ff869809de
--- /dev/null
+++ b/web/src/pages/dataflow-result/chunker.tsx
@@ -0,0 +1,234 @@
+import message from '@/components/ui/message';
+import {
+ RAGFlowPagination,
+ RAGFlowPaginationType,
+} from '@/components/ui/ragflow-pagination';
+import { Spin } from '@/components/ui/spin';
+import {
+ useFetchNextChunkList,
+ useSwitchChunk,
+} from '@/hooks/use-chunk-request';
+import classNames from 'classnames';
+import { useCallback, useEffect, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import ChunkCard from './components/chunk-card';
+import CreatingModal from './components/chunk-creating-modal';
+import ChunkResultBar from './components/chunk-result-bar';
+import CheckboxSets from './components/chunk-result-bar/checkbox-sets';
+import RerunButton from './components/rerun-button';
+import {
+ useChangeChunkTextMode,
+ useDeleteChunkByIds,
+ useHandleChunkCardClick,
+ useUpdateChunk,
+} from './hooks';
+import styles from './index.less';
+const ChunkerContainer = () => {
+ const [selectedChunkIds, setSelectedChunkIds] = useState<string[]>([]);
+ const [isChange, setIsChange] = useState(false);
+ const { t } = useTranslation();
+ const {
+ data: { documentInfo, data = [], total },
+ pagination,
+ loading,
+ searchString,
+ handleInputChange,
+ available,
+ handleSetAvailable,
+ } = useFetchNextChunkList();
+ const { handleChunkCardClick, selectedChunkId } = useHandleChunkCardClick();
+ const isPdf = documentInfo?.type === 'pdf';
+ const {
+ chunkUpdatingLoading,
+ onChunkUpdatingOk,
+ showChunkUpdatingModal,
+ hideChunkUpdatingModal,
+ chunkId,
+ chunkUpdatingVisible,
+ documentId,
+ } = useUpdateChunk();
+ const { removeChunk } = useDeleteChunkByIds();
+ const { changeChunkTextMode, textMode } = useChangeChunkTextMode();
+ const selectAllChunk = useCallback(
+ (checked: boolean) => {
+ setSelectedChunkIds(checked ? data.map((x) => x.chunk_id) : []);
+ },
+ [data],
+ );
+ const showSelectedChunkWarning = useCallback(() => {
+ message.warning(t('message.pleaseSelectChunk'));
+ }, [t]);
+ const { switchChunk } = useSwitchChunk();
+
+ const [chunkList, setChunkList] = useState(data);
+ useEffect(() => {
+ setChunkList(data);
+ }, [data]);
+ const onPaginationChange: RAGFlowPaginationType['onChange'] = (
+ page,
+ size,
+ ) => {
+ setSelectedChunkIds([]);
+ pagination.onChange?.(page, size);
+ };
+
+ const handleSwitchChunk = useCallback(
+ async (available?: number, chunkIds?: string[]) => {
+ let ids = chunkIds;
+ if (!chunkIds) {
+ ids = selectedChunkIds;
+ if (selectedChunkIds.length === 0) {
+ showSelectedChunkWarning();
+ return;
+ }
+ }
+
+ const resCode: number = await switchChunk({
+ chunk_ids: ids,
+ available_int: available,
+ doc_id: documentId,
+ });
+ if (ids?.length && resCode === 0) {
+ chunkList.forEach((x: any) => {
+ if (ids.indexOf(x['chunk_id']) > -1) {
+ x['available_int'] = available;
+ }
+ });
+ setChunkList(chunkList);
+ }
+ },
+ [
+ switchChunk,
+ documentId,
+ selectedChunkIds,
+ showSelectedChunkWarning,
+ chunkList,
+ ],
+ );
+ const handleSingleCheckboxClick = useCallback(
+ (chunkId: string, checked: boolean) => {
+ setSelectedChunkIds((previousIds) => {
+ const idx = previousIds.findIndex((x) => x === chunkId);
+ const nextIds = [...previousIds];
+ if (checked && idx === -1) {
+ nextIds.push(chunkId);
+ } else if (!checked && idx !== -1) {
+ nextIds.splice(idx, 1);
+ }
+ return nextIds;
+ });
+ },
+ [],
+ );
+ const handleRemoveChunk = useCallback(async () => {
+ if (selectedChunkIds.length > 0) {
+ const resCode: number = await removeChunk(selectedChunkIds, documentId);
+ if (resCode === 0) {
+ setSelectedChunkIds([]);
+ }
+ } else {
+ showSelectedChunkWarning();
+ }
+ }, [selectedChunkIds, documentId, removeChunk, showSelectedChunkWarning]);
+
+ const handleChunkEditSave = (e: any) => {
+ setIsChange(true);
+ onChunkUpdatingOk(e);
+ };
+ return (
+ <>
+ {isChange && (
+ <div className=" absolute top-2 right-6">
+ <RerunButton />
+ </div>
+ )}
+ <div
+ className={classNames(
+ { [styles.pagePdfWrapper]: isPdf },
+ 'flex flex-col w-3/5',
+ )}
+ >
+ <Spin spinning={loading} className={styles.spin} size="large">
+ <div className="h-[50px] flex flex-row justify-between items-end pb-[5px]">
+ <div>
+ <h2 className="text-[16px]">{t('chunk.chunkResult')}</h2>
+ <div className="text-[12px] text-text-secondary italic">
+ {t('chunk.chunkResultTip')}
+ </div>
+ </div>
+ <ChunkResultBar
+ handleInputChange={handleInputChange}
+ searchString={searchString}
+ changeChunkTextMode={changeChunkTextMode}
+ createChunk={showChunkUpdatingModal}
+ available={available}
+ selectAllChunk={selectAllChunk}
+ handleSetAvailable={handleSetAvailable}
+ />
+ </div>
+ <div className=" rounded-[16px] box-border mb-2">
+ <div className="pt-[5px] pb-[5px]">
+ <CheckboxSets
+ selectAllChunk={selectAllChunk}
+ switchChunk={handleSwitchChunk}
+ removeChunk={handleRemoveChunk}
+ checked={selectedChunkIds.length === data.length}
+ selectedChunkIds={selectedChunkIds}
+ />
+ </div>
+ <div className="h-[calc(100vh-280px)] overflow-y-auto pr-2 scrollbar-thin">
+ <div
+ className={classNames(
+ styles.chunkContainer,
+ {
+ [styles.chunkOtherContainer]: !isPdf,
+ },
+ 'flex flex-col gap-4',
+ )}
+ >
+ {chunkList.map((item) => (
+ <ChunkCard
+ item={item}
+ key={item.chunk_id}
+ editChunk={showChunkUpdatingModal}
+ checked={selectedChunkIds.some((x) => x === item.chunk_id)}
+ handleCheckboxClick={handleSingleCheckboxClick}
+ switchChunk={handleSwitchChunk}
+ clickChunkCard={handleChunkCardClick}
+ selected={item.chunk_id === selectedChunkId}
+ textMode={textMode}
+ ></ChunkCard>
+ ))}
+ </div>
+ </div>
+ <div className={styles.pageFooter}>
+ <RAGFlowPagination
+ pageSize={pagination.pageSize}
+ current={pagination.current}
+ total={total}
+ onChange={(page, pageSize) => {
+ onPaginationChange(page, pageSize);
+ }}
+ ></RAGFlowPagination>
+ </div>
+ </div>
+ </Spin>
+ </div>
+ {chunkUpdatingVisible && (
+ <CreatingModal
+ doc_id={documentId}
+ chunkId={chunkId}
+ hideModal={hideChunkUpdatingModal}
+ visible={chunkUpdatingVisible}
+ loading={chunkUpdatingLoading}
+ onOk={(e) => {
+ handleChunkEditSave(e);
+ }}
+ parserId={documentInfo.parser_id}
+ />
+ )}
+ </>
+ );
+};
+
+export { ChunkerContainer };
diff --git a/web/src/pages/dataflow-result/components/chunk-card/index.less b/web/src/pages/dataflow-result/components/chunk-card/index.less
new file mode 100644
index 0000000000..aac7724af4
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/chunk-card/index.less
@@ -0,0 +1,36 @@
+.image {
+ width: 100px !important;
+ object-fit: contain;
+}
+
+.imagePreview {
+ max-width: 50vw;
+ max-height: 50vh;
+ object-fit: contain;
+}
+
+.content {
+ flex: 1;
+ .chunkText;
+}
+
+.contentEllipsis {
+ .multipleLineEllipsis(3);
+}
+
+.contentText {
+ word-break: break-all !important;
+}
+
+.chunkCard {
+ width: 100%;
+ padding: 18px 10px;
+}
+
+.cardSelected {
+ background-color: @selectedBackgroundColor;
+}
+
+.cardSelectedDark {
+ background-color: #ffffff2f;
+}
diff --git a/web/src/pages/dataflow-result/components/chunk-card/index.tsx b/web/src/pages/dataflow-result/components/chunk-card/index.tsx
new file mode 100644
index 0000000000..198746aefe
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/chunk-card/index.tsx
@@ -0,0 +1,127 @@
+import Image from '@/components/image';
+import { useTheme } from '@/components/theme-provider';
+import { Card } from '@/components/ui/card';
+import { Checkbox } from '@/components/ui/checkbox';
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from '@/components/ui/popover';
+import { Switch } from '@/components/ui/switch';
+import { IChunk } from '@/interfaces/database/knowledge';
+import { CheckedState } from '@radix-ui/react-checkbox';
+import classNames from 'classnames';
+import DOMPurify from 'dompurify';
+import { useEffect, useState } from 'react';
+import { ChunkTextMode } from '../../constant';
+import styles from './index.less';
+
+interface IProps {
+ item: IChunk;
+ checked: boolean;
+ switchChunk: (available?: number, chunkIds?: string[]) => void;
+ editChunk: (chunkId: string) => void;
+ handleCheckboxClick: (chunkId: string, checked: boolean) => void;
+ selected: boolean;
+ clickChunkCard: (chunkId: string) => void;
+ textMode: ChunkTextMode;
+}
+
+const ChunkCard = ({
+ item,
+ checked,
+ handleCheckboxClick,
+ editChunk,
+ switchChunk,
+ selected,
+ clickChunkCard,
+ textMode,
+}: IProps) => {
+ const available = Number(item.available_int);
+ const [enabled, setEnabled] = useState(false);
+ const { theme } = useTheme();
+
+ const onChange = (checked: boolean) => {
+ setEnabled(checked);
+ switchChunk(available === 0 ? 1 : 0, [item.chunk_id]);
+ };
+
+ const handleCheck = (e: CheckedState) => {
+ handleCheckboxClick(item.chunk_id, e === 'indeterminate' ? false : e);
+ };
+
+ const handleContentDoubleClick = () => {
+ editChunk(item.chunk_id);
+ };
+
+ const handleContentClick = () => {
+ clickChunkCard(item.chunk_id);
+ };
+
+ useEffect(() => {
+ setEnabled(available === 1);
+ }, [available]);
+ const [open, setOpen] = useState<boolean>(false);
+ return (
+ <Card
+ className={classNames('rounded-lg w-full py-3 px-3', {
+ 'bg-bg-title': selected,
+ 'bg-bg-input': !selected,
+ })}
+ >
+ <div className="flex items-start justify-between gap-2">
+ <Checkbox onCheckedChange={handleCheck} checked={checked}></Checkbox>
+ {item.image_id && (
+ <Popover open={open}>
+ <PopoverTrigger
+ asChild
+ onMouseEnter={() => setOpen(true)}
+ onMouseLeave={() => setOpen(false)}
+ >
+ <div>
+ <Image id={item.image_id} className={styles.image}></Image>
+ </div>
+ </PopoverTrigger>
+ <PopoverContent
+ className="p-0"
+ align={'start'}
+ side={'right'}
+ sideOffset={-20}
+ >
+ <div>
+ <Image
+ id={item.image_id}
+ className={styles.imagePreview}
+ ></Image>
+ </div>
+ </PopoverContent>
+ </Popover>
+ )}
+ <section
+ onDoubleClick={handleContentDoubleClick}
+ onClick={handleContentClick}
+ className={styles.content}
+ >
+ <div
+ dangerouslySetInnerHTML={{
+ __html: DOMPurify.sanitize(item.content_with_weight),
+ }}
+ className={classNames(styles.contentText, {
+ [styles.contentEllipsis]: textMode === ChunkTextMode.Ellipse,
+ })}
+ ></div>
+ </section>
+ <div>
+ <Switch
+ checked={enabled}
+ onCheckedChange={onChange}
+ aria-readonly
+ className="!m-0"
+ />
+ </div>
+ </div>
+ </Card>
+ );
+};
+
+export default ChunkCard;
diff --git a/web/src/pages/dataflow-result/components/chunk-creating-modal/index.tsx b/web/src/pages/dataflow-result/components/chunk-creating-modal/index.tsx
new file mode 100644
index 0000000000..66cf4d619c
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/chunk-creating-modal/index.tsx
@@ -0,0 +1,206 @@
+import EditTag from '@/components/edit-tag';
+import Divider from '@/components/ui/divider';
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from '@/components/ui/form';
+import {
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+} from '@/components/ui/hover-card';
+import { Modal } from '@/components/ui/modal/modal';
+import Space from '@/components/ui/space';
+import { Switch } from '@/components/ui/switch';
+import { Textarea } from '@/components/ui/textarea';
+import { useFetchChunk } from '@/hooks/chunk-hooks';
+import { IModalProps } from '@/interfaces/common';
+import { Trash2 } from 'lucide-react';
+import React, { useCallback, useEffect, useState } from 'react';
+import { FieldValues, FormProvider, useForm } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+import { useDeleteChunkByIds } from '../../hooks';
+import {
+ transformTagFeaturesArrayToObject,
+ transformTagFeaturesObjectToArray,
+} from '../../utils';
+import { TagFeatureItem } from './tag-feature-item';
+
+interface kFProps {
+ doc_id: string;
+ chunkId: string | undefined;
+ parserId: string;
+}
+
+const ChunkCreatingModal: React.FC<IModalProps<any> & kFProps> = ({
+ doc_id,
+ chunkId,
+ hideModal,
+ onOk,
+ loading,
+ parserId,
+}) => {
+ // const [form] = Form.useForm();
+ // const form = useFormContext();
+ const form = useForm<FieldValues>({
+ defaultValues: {
+ content_with_weight: '',
+ tag_kwd: [],
+ question_kwd: [],
+ important_kwd: [],
+ tag_feas: [],
+ },
+ });
+ const [checked, setChecked] = useState(false);
+ const { removeChunk } = useDeleteChunkByIds();
+ const { data } = useFetchChunk(chunkId);
+ const { t } = useTranslation();
+
+ const isTagParser = parserId === 'tag';
+ const onSubmit = useCallback(
+ (values: FieldValues) => {
+ onOk?.({
+ ...values,
+ tag_feas: transformTagFeaturesArrayToObject(values.tag_feas),
+ available_int: checked ? 1 : 0,
+ });
+ },
+ [checked, onOk],
+ );
+
+ const handleOk = form.handleSubmit(onSubmit);
+
+ const handleRemove = useCallback(() => {
+ if (chunkId) {
+ return removeChunk([chunkId], doc_id);
+ }
+ }, [chunkId, doc_id, removeChunk]);
+
+ const handleCheck = useCallback(() => {
+ setChecked(!checked);
+ }, [checked]);
+
+ useEffect(() => {
+ if (data?.code === 0) {
+ const { available_int, tag_feas } = data.data;
+ form.reset({
+ ...data.data,
+ tag_feas: transformTagFeaturesObjectToArray(tag_feas),
+ });
+
+ setChecked(available_int !== 0);
+ }
+ }, [data, form, chunkId]);
+
+ return (
+ <Modal
+ title={`${chunkId ? t('common.edit') : t('common.create')} ${t('chunk.chunk')}`}
+ open={true}
+ onOk={handleOk}
+ onCancel={hideModal}
+ confirmLoading={loading}
+ destroyOnClose
+ >
+ <Form {...form}>
+ <div className="flex flex-col gap-4">
+ <FormField
+ control={form.control}
+ name="content_with_weight"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>{t('chunk.chunk')}</FormLabel>
+ <FormControl>
+ <Textarea {...field} autoSize={{ minRows: 4, maxRows: 10 }} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="important_kwd"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>{t('chunk.keyword')}</FormLabel>
+ <FormControl>
+ <EditTag {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ <FormField
+ control={form.control}
+ name="question_kwd"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel className="flex justify-start items-start">
+ <div className="flex items-center gap-0">
+ <span>{t('chunk.question')}</span>
+ <HoverCard>
+ <HoverCardTrigger asChild>
+ <span className="text-xs mt-[-3px] text-center scale-[90%] font-thin text-primary cursor-pointer rounded-full w-[16px] h-[16px] border-muted-foreground/50 border">
+ ?
+ </span>
+ </HoverCardTrigger>
+ <HoverCardContent className="w-80" side="top">
+ {t('chunk.questionTip')}
+ </HoverCardContent>
+ </HoverCard>
+ </div>
+ </FormLabel>
+ <FormControl>
+ <EditTag {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+
+ {isTagParser && (
+ <FormField
+ control={form.control}
+ name="tag_kwd"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel>{t('knowledgeConfiguration.tagName')}</FormLabel>
+ <FormControl>
+ <EditTag {...field} />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ )}
+
+ {!isTagParser && (
+ <FormProvider {...form}>
+ <TagFeatureItem />
+ </FormProvider>
+ )}
+ </div>
+ </Form>
+
+ {chunkId && (
+ <section>
+ <Divider />
+ <Space size={'large'}>
+ <div className="flex items-center gap-2">
+ {t('chunk.enabled')}
+ <Switch checked={checked} onCheckedChange={handleCheck} />
+ </div>
+ <div className="flex items-center gap-1" onClick={handleRemove}>
+ <Trash2 size={16} /> {t('common.delete')}
+ </div>
+ </Space>
+ </section>
+ )}
+ </Modal>
+ );
+};
+export default ChunkCreatingModal;
diff --git a/web/src/pages/dataflow-result/components/chunk-creating-modal/tag-feature-item.tsx b/web/src/pages/dataflow-result/components/chunk-creating-modal/tag-feature-item.tsx
new file mode 100644
index 0000000000..3c9f92c78d
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/chunk-creating-modal/tag-feature-item.tsx
@@ -0,0 +1,136 @@
+import { SelectWithSearch } from '@/components/originui/select-with-search';
+import { Button } from '@/components/ui/button';
+import {
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from '@/components/ui/form';
+import { NumberInput } from '@/components/ui/input';
+import { useFetchTagListByKnowledgeIds } from '@/hooks/knowledge-hooks';
+import { useFetchKnowledgeBaseConfiguration } from '@/hooks/use-knowledge-request';
+import { CircleMinus, Plus } from 'lucide-react';
+import { useCallback, useEffect, useMemo } from 'react';
+import { useFieldArray, useFormContext } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+import { FormListItem } from '../../utils';
+
+const FieldKey = 'tag_feas';
+
+export const TagFeatureItem = () => {
+ const { t } = useTranslation();
+ const { setKnowledgeIds, list } = useFetchTagListByKnowledgeIds();
+ const { data: knowledgeConfiguration } = useFetchKnowledgeBaseConfiguration();
+ const form = useFormContext();
+ const tagKnowledgeIds = useMemo(() => {
+ return knowledgeConfiguration?.parser_config?.tag_kb_ids ?? [];
+ }, [knowledgeConfiguration?.parser_config?.tag_kb_ids]);
+
+ const options = useMemo(() => {
+ return list.map((x) => ({
+ value: x[0],
+ label: x[0],
+ }));
+ }, [list]);
+
+ const filterOptions = useCallback(
+ (index: number) => {
+ const tags: FormListItem[] = form.getValues(FieldKey) ?? [];
+
+ // Exclude it's own current data
+ const list = tags
+ .filter((x, idx) => x && index !== idx)
+ .map((x) => x.tag);
+ // Exclude the selected data from other options from one's own options.
+ const resultList = options.filter(
+ (x) => !list.some((y) => x.value === y),
+ );
+ return resultList;
+ },
+ [form, options],
+ );
+
+ useEffect(() => {
+ setKnowledgeIds(tagKnowledgeIds);
+ }, [setKnowledgeIds, tagKnowledgeIds]);
+
+ const { fields, append, remove } = useFieldArray({
+ control: form.control,
+ name: FieldKey,
+ });
+ return (
+ <FormField
+ control={form.control}
+ name={FieldKey as any}
+ render={() => (
+ <FormItem>
+ <FormLabel>{t('knowledgeConfiguration.tags')}</FormLabel>
+ <div>
+ {fields.map((item, name) => {
+ return (
+ <div key={item.id} className="flex gap-3 items-center mb-4">
+ <div className="flex flex-1 gap-8">
+ <FormField
+ control={form.control}
+ name={`${FieldKey}.${name}.tag` as any}
+ render={({ field }) => (
+ <FormItem className="w-2/3">
+ <FormControl className="w-full">
+ <div>
+ <SelectWithSearch
+ options={filterOptions(name)}
+ placeholder={t(
+ 'knowledgeConfiguration.tagName',
+ )}
+ value={field.value}
+ onChange={field.onChange}
+ />
+ </div>
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name={`${FieldKey}.${name}.frequency`}
+ render={({ field }) => (
+ <FormItem>
+ <FormControl>
+ <NumberInput
+ value={field.value}
+ onChange={field.onChange}
+ placeholder={t(
+ 'knowledgeConfiguration.frequency',
+ )}
+ max={10}
+ min={0}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+ <CircleMinus
+ onClick={() => remove(name)}
+ className="text-red-500"
+ />
+ </div>
+ );
+ })}
+ <Button
+ variant="dashed"
+ className="w-full flex items-center justify-center gap-2"
+ onClick={() => append({ tag: '', frequency: 0 })}
+ >
+ <Plus size={16} />
+ {t('knowledgeConfiguration.addTag')}
+ </Button>
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/chunk-result-bar/checkbox-sets.tsx b/web/src/pages/dataflow-result/components/chunk-result-bar/checkbox-sets.tsx
new file mode 100644
index 0000000000..68bafeeb75
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/chunk-result-bar/checkbox-sets.tsx
@@ -0,0 +1,85 @@
+import { Checkbox } from '@/components/ui/checkbox';
+import { Label } from '@/components/ui/label';
+import { Ban, CircleCheck, Trash2 } from 'lucide-react';
+import { useCallback, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+type ICheckboxSetProps = {
+ selectAllChunk: (e: any) => void;
+ removeChunk: (e?: any) => void;
+ switchChunk: (available: number) => void;
+ checked: boolean;
+ selectedChunkIds: string[];
+};
+export default (props: ICheckboxSetProps) => {
+ const {
+ selectAllChunk,
+ removeChunk,
+ switchChunk,
+ checked,
+ selectedChunkIds,
+ } = props;
+ const { t } = useTranslation();
+ const handleSelectAllCheck = useCallback(
+ (e: any) => {
+ console.log('eee=', e);
+ selectAllChunk(e);
+ },
+ [selectAllChunk],
+ );
+
+ const handleDeleteClick = useCallback(() => {
+ removeChunk();
+ }, [removeChunk]);
+
+ const handleEnabledClick = useCallback(() => {
+ switchChunk(1);
+ }, [switchChunk]);
+
+ const handleDisabledClick = useCallback(() => {
+ switchChunk(0);
+ }, [switchChunk]);
+
+ const isSelected = useMemo(() => {
+ return selectedChunkIds?.length > 0;
+ }, [selectedChunkIds]);
+
+ return (
+ <div className="flex gap-[40px] py-4 px-2">
+ <div className="flex items-center gap-3 cursor-pointer text-muted-foreground hover:text-text-primary">
+ <Checkbox
+ id="all_chunks_checkbox"
+ onCheckedChange={handleSelectAllCheck}
+ checked={checked}
+ className=" data-[state=checked]:bg-text-primary data-[state=checked]:border-text-primary data-[state=checked]:text-bg-base border-muted-foreground text-muted-foreground hover:text-bg-base hover:border-text-primary "
+ />
+ <Label htmlFor="all_chunks_checkbox">{t('chunk.selectAll')}</Label>
+ </div>
+ {isSelected && (
+ <>
+ <div
+ className="flex items-center cursor-pointer text-muted-foreground hover:text-text-primary"
+ onClick={handleEnabledClick}
+ >
+ <CircleCheck size={16} />
+ <span className="block ml-1">{t('chunk.enable')}</span>
+ </div>
+ <div
+ className="flex items-center cursor-pointer text-muted-foreground hover:text-text-primary"
+ onClick={handleDisabledClick}
+ >
+ <Ban size={16} />
+ <span className="block ml-1">{t('chunk.disable')}</span>
+ </div>
+ <div
+ className="flex items-center cursor-pointer text-red-400 hover:text-red-500"
+ onClick={handleDeleteClick}
+ >
+ <Trash2 size={16} />
+ <span className="block ml-1">{t('chunk.delete')}</span>
+ </div>
+ </>
+ )}
+ </div>
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/chunk-result-bar/index.tsx b/web/src/pages/dataflow-result/components/chunk-result-bar/index.tsx
new file mode 100644
index 0000000000..3683174416
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/chunk-result-bar/index.tsx
@@ -0,0 +1,108 @@
+import { Input } from '@/components/originui/input';
+import { Button } from '@/components/ui/button';
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from '@/components/ui/popover';
+import { Radio } from '@/components/ui/radio';
+import { useTranslate } from '@/hooks/common-hooks';
+import { cn } from '@/lib/utils';
+import { SearchOutlined } from '@ant-design/icons';
+import { ListFilter, Plus } from 'lucide-react';
+import { useState } from 'react';
+import { ChunkTextMode } from '../../constant';
+interface ChunkResultBarProps {
+ changeChunkTextMode: React.Dispatch<React.SetStateAction<string | number>>;
+ available: number | undefined;
+ selectAllChunk: (value: boolean) => void;
+ handleSetAvailable: (value: number | undefined) => void;
+ createChunk: () => void;
+ handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
+ searchString: string;
+}
+export default ({
+ changeChunkTextMode,
+ available,
+ selectAllChunk,
+ handleSetAvailable,
+ createChunk,
+ handleInputChange,
+ searchString,
+}: ChunkResultBarProps) => {
+ const { t } = useTranslate('chunk');
+ const [textSelectValue, setTextSelectValue] = useState<string | number>(
+ ChunkTextMode.Full,
+ );
+ const handleFilterChange = (e: string | number) => {
+ const value = e === -1 ? undefined : (e as number);
+ selectAllChunk(false);
+ handleSetAvailable(value);
+ };
+ const filterContent = (
+ <div className="w-[200px]">
+ <Radio.Group onChange={handleFilterChange} value={available}>
+ <div className="flex flex-col gap-2 p-4">
+ <Radio value={-1}>{t('all')}</Radio>
+ <Radio value={1}>{t('enabled')}</Radio>
+ <Radio value={0}>{t('disabled')}</Radio>
+ </div>
+ </Radio.Group>
+ </div>
+ );
+ const textSelectOptions = [
+ { label: t(ChunkTextMode.Full), value: ChunkTextMode.Full },
+ { label: t(ChunkTextMode.Ellipse), value: ChunkTextMode.Ellipse },
+ ];
+
+ const changeTextSelectValue = (value: string | number) => {
+ setTextSelectValue(value);
+ changeChunkTextMode(value);
+ };
+ return (
+ <div className="flex gap-2">
+ <div className="flex items-center gap-1 bg-bg-card text-muted-foreground w-fit h-[35px] rounded-md p-1">
+ {textSelectOptions.map((option) => (
+ <div
+ key={option.value}
+ className={cn(
+ 'flex items-center cursor-pointer px-4 py-1 rounded-md',
+ {
+ 'text-primary bg-bg-base': option.value === textSelectValue,
+ 'text-text-primary': option.value !== textSelectValue,
+ },
+ )}
+ onClick={() => changeTextSelectValue(option.value)}
+ >
+ {option.label}
+ </div>
+ ))}
+ </div>
+ <Input
+ className="bg-bg-card text-muted-foreground"
+ style={{ width: 200 }}
+ placeholder={t('search')}
+ icon={<SearchOutlined />}
+ onChange={handleInputChange}
+ value={searchString}
+ />
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button className="bg-bg-card text-muted-foreground hover:bg-card">
+ <ListFilter />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="p-0 w-[200px]">
+ {filterContent}
+ </PopoverContent>
+ </Popover>
+ <Button
+ onClick={() => createChunk()}
+ variant={'secondary'}
+ className="bg-bg-card text-muted-foreground hover:bg-card"
+ >
+ <Plus size={44} />
+ </Button>
+ </div>
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/chunk-toolbar/index.tsx b/web/src/pages/dataflow-result/components/chunk-toolbar/index.tsx
new file mode 100644
index 0000000000..6a513ba78d
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/chunk-toolbar/index.tsx
@@ -0,0 +1,221 @@
+import { ReactComponent as FilterIcon } from '@/assets/filter.svg';
+import { KnowledgeRouteKey } from '@/constants/knowledge';
+import { IChunkListResult, useSelectChunkList } from '@/hooks/chunk-hooks';
+import { useTranslate } from '@/hooks/common-hooks';
+import { useKnowledgeBaseId } from '@/hooks/knowledge-hooks';
+import {
+ ArrowLeftOutlined,
+ CheckCircleOutlined,
+ CloseCircleOutlined,
+ DeleteOutlined,
+ DownOutlined,
+ FilePdfOutlined,
+ PlusOutlined,
+ SearchOutlined,
+} from '@ant-design/icons';
+import {
+ Button,
+ Checkbox,
+ Flex,
+ Input,
+ Menu,
+ MenuProps,
+ Popover,
+ Radio,
+ RadioChangeEvent,
+ Segmented,
+ SegmentedProps,
+ Space,
+ Typography,
+} from 'antd';
+import { useCallback, useMemo, useState } from 'react';
+import { Link } from 'umi';
+import { ChunkTextMode } from '../../constant';
+
+const { Text } = Typography;
+
+interface IProps
+ extends Pick<
+ IChunkListResult,
+ 'searchString' | 'handleInputChange' | 'available' | 'handleSetAvailable'
+ > {
+ checked: boolean;
+ selectAllChunk: (checked: boolean) => void;
+ createChunk: () => void;
+ removeChunk: () => void;
+ switchChunk: (available: number) => void;
+ changeChunkTextMode(mode: ChunkTextMode): void;
+}
+
+const ChunkToolBar = ({
+ selectAllChunk,
+ checked,
+ createChunk,
+ removeChunk,
+ switchChunk,
+ changeChunkTextMode,
+ available,
+ handleSetAvailable,
+ searchString,
+ handleInputChange,
+}: IProps) => {
+ const data = useSelectChunkList();
+ const documentInfo = data?.documentInfo;
+ const knowledgeBaseId = useKnowledgeBaseId();
+ const [isShowSearchBox, setIsShowSearchBox] = useState(false);
+ const { t } = useTranslate('chunk');
+
+ const handleSelectAllCheck = useCallback(
+ (e: any) => {
+ selectAllChunk(e.target.checked);
+ },
+ [selectAllChunk],
+ );
+
+ const handleSearchIconClick = () => {
+ setIsShowSearchBox(true);
+ };
+
+ const handleSearchBlur = () => {
+ if (!searchString?.trim()) {
+ setIsShowSearchBox(false);
+ }
+ };
+
+ const handleDelete = useCallback(() => {
+ removeChunk();
+ }, [removeChunk]);
+
+ const handleEnabledClick = useCallback(() => {
+ switchChunk(1);
+ }, [switchChunk]);
+
+ const handleDisabledClick = useCallback(() => {
+ switchChunk(0);
+ }, [switchChunk]);
+
+ const items: MenuProps['items'] = useMemo(() => {
+ return [
+ {
+ key: '1',
+ label: (
+ <>
+ <Checkbox onChange={handleSelectAllCheck} checked={checked}>
+ <b>{t('selectAll')}</b>
+ </Checkbox>
+ </>
+ ),
+ },
+ { type: 'divider' },
+ {
+ key: '2',
+ label: (
+ <Space onClick={handleEnabledClick}>
+ <CheckCircleOutlined />
+ <b>{t('enabledSelected')}</b>
+ </Space>
+ ),
+ },
+ {
+ key: '3',
+ label: (
+ <Space onClick={handleDisabledClick}>
+ <CloseCircleOutlined />
+ <b>{t('disabledSelected')}</b>
+ </Space>
+ ),
+ },
+ { type: 'divider' },
+ {
+ key: '4',
+ label: (
+ <Space onClick={handleDelete}>
+ <DeleteOutlined />
+ <b>{t('deleteSelected')}</b>
+ </Space>
+ ),
+ },
+ ];
+ }, [
+ checked,
+ handleSelectAllCheck,
+ handleDelete,
+ handleEnabledClick,
+ handleDisabledClick,
+ t,
+ ]);
+
+ const content = (
+ <Menu style={{ width: 200 }} items={items} selectable={false} />
+ );
+
+ const handleFilterChange = (e: RadioChangeEvent) => {
+ selectAllChunk(false);
+ handleSetAvailable(e.target.value);
+ };
+
+ const filterContent = (
+ <Radio.Group onChange={handleFilterChange} value={available}>
+ <Space direction="vertical">
+ <Radio value={undefined}>{t('all')}</Radio>
+ <Radio value={1}>{t('enabled')}</Radio>
+ <Radio value={0}>{t('disabled')}</Radio>
+ </Space>
+ </Radio.Group>
+ );
+
+ return (
+ <Flex justify="space-between" align="center">
+ <Space size={'middle'}>
+ <Link
+ to={`/knowledge/${KnowledgeRouteKey.Dataset}?id=${knowledgeBaseId}`}
+ >
+ <ArrowLeftOutlined />
+ </Link>
+ <FilePdfOutlined />
+ <Text ellipsis={{ tooltip: documentInfo?.name }} style={{ width: 150 }}>
+ {documentInfo?.name}
+ </Text>
+ </Space>
+ <Space>
+ <Segmented
+ options={[
+ { label: t(ChunkTextMode.Full), value: ChunkTextMode.Full },
+ { label: t(ChunkTextMode.Ellipse), value: ChunkTextMode.Ellipse },
+ ]}
+ onChange={changeChunkTextMode as SegmentedProps['onChange']}
+ />
+ <Popover content={content} placement="bottom" arrow={false}>
+ <Button>
+ {t('bulk')}
+ <DownOutlined />
+ </Button>
+ </Popover>
+ {isShowSearchBox ? (
+ <Input
+ size="middle"
+ placeholder={t('search')}
+ prefix={<SearchOutlined />}
+ allowClear
+ onChange={handleInputChange}
+ onBlur={handleSearchBlur}
+ value={searchString}
+ />
+ ) : (
+ <Button icon={<SearchOutlined />} onClick={handleSearchIconClick} />
+ )}
+
+ <Popover content={filterContent} placement="bottom" arrow={false}>
+ <Button icon={<FilterIcon />} />
+ </Popover>
+ <Button
+ icon={<PlusOutlined />}
+ type="primary"
+ onClick={() => createChunk()}
+ />
+ </Space>
+ </Flex>
+ );
+};
+
+export default ChunkToolBar;
diff --git a/web/src/pages/dataflow-result/components/document-preview/csv-preview.tsx b/web/src/pages/dataflow-result/components/document-preview/csv-preview.tsx
new file mode 100644
index 0000000000..45b05454e1
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/csv-preview.tsx
@@ -0,0 +1,114 @@
+import message from '@/components/ui/message';
+import { Spin } from '@/components/ui/spin';
+import request from '@/utils/request';
+import classNames from 'classnames';
+import React, { useEffect, useRef, useState } from 'react';
+
+interface CSVData {
+ rows: string[][];
+ headers: string[];
+}
+
+interface FileViewerProps {
+ className?: string;
+ url: string;
+}
+
+const CSVFileViewer: React.FC<FileViewerProps> = ({ url }) => {
+ const [data, setData] = useState<CSVData | null>(null);
+ const [isLoading, setIsLoading] = useState<boolean>(true);
+ const containerRef = useRef<HTMLDivElement>(null);
+ // const url = useGetDocumentUrl();
+ const parseCSV = (csvText: string): CSVData => {
+ console.log('Parsing CSV data:', csvText);
+ const lines = csvText.split('\n');
+ const headers = lines[0].split(',').map((header) => header.trim());
+ const rows = lines
+ .slice(1)
+ .map((line) => line.split(',').map((cell) => cell.trim()));
+
+ return { headers, rows };
+ };
+
+ useEffect(() => {
+ const loadCSV = async () => {
+ try {
+ const res = await request(url, {
+ method: 'GET',
+ responseType: 'blob',
+ onError: () => {
+ message.error('file load failed');
+ setIsLoading(false);
+ },
+ });
+
+ // parse CSV file
+ const reader = new FileReader();
+ reader.readAsText(res.data);
+ reader.onload = () => {
+ const parsedData = parseCSV(reader.result as string);
+ console.log('file loaded successfully', reader.result);
+ setData(parsedData);
+ };
+ } catch (error) {
+ message.error('CSV file parse failed');
+ console.error('Error loading CSV file:', error);
+ } finally {
+ setIsLoading(false);
+ }
+ };
+
+ loadCSV();
+
+ return () => {
+ setData(null);
+ };
+ }, [url]);
+
+ return (
+ <div
+ ref={containerRef}
+ className={classNames(
+ 'relative w-full h-full p-4 bg-background-paper border border-border-normal rounded-md',
+ 'overflow-auto max-h-[80vh] p-2',
+ )}
+ >
+ {isLoading ? (
+ <div className="absolute inset-0 flex items-center justify-center">
+ <Spin />
+ </div>
+ ) : data ? (
+ <table className="min-w-full divide-y divide-border-normal">
+ <thead className="bg-background-header-bar">
+ <tr>
+ {data.headers.map((header, index) => (
+ <th
+ key={`header-${index}`}
+ className="px-6 py-3 text-left text-sm font-medium text-text-primary"
+ >
+ {header}
+ </th>
+ ))}
+ </tr>
+ </thead>
+ <tbody className="bg-background-paper divide-y divide-border-normal">
+ {data.rows.map((row, rowIndex) => (
+ <tr key={`row-${rowIndex}`}>
+ {row.map((cell, cellIndex) => (
+ <td
+ key={`cell-${rowIndex}-${cellIndex}`}
+ className="px-6 py-4 whitespace-nowrap text-sm text-text-secondary"
+ >
+ {cell || '-'}
+ </td>
+ ))}
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ ) : null}
+ </div>
+ );
+};
+
+export default CSVFileViewer;
diff --git a/web/src/pages/dataflow-result/components/document-preview/doc-preview.tsx b/web/src/pages/dataflow-result/components/document-preview/doc-preview.tsx
new file mode 100644
index 0000000000..845f0374e3
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/doc-preview.tsx
@@ -0,0 +1,70 @@
+import message from '@/components/ui/message';
+import { Spin } from '@/components/ui/spin';
+import request from '@/utils/request';
+import classNames from 'classnames';
+import mammoth from 'mammoth';
+import { useEffect, useState } from 'react';
+
+interface DocPreviewerProps {
+ className?: string;
+ url: string;
+}
+
+export const DocPreviewer: React.FC<DocPreviewerProps> = ({
+ className,
+ url,
+}) => {
+ // const url = useGetDocumentUrl();
+ const [htmlContent, setHtmlContent] = useState<string>('');
+ const [loading, setLoading] = useState(false);
+ const fetchDocument = async () => {
+ setLoading(true);
+ const res = await request(url, {
+ method: 'GET',
+ responseType: 'blob',
+ onError: () => {
+ message.error('Document parsing failed');
+ console.error('Error loading document:', url);
+ },
+ });
+ try {
+ const arrayBuffer = await res.data.arrayBuffer();
+ const result = await mammoth.convertToHtml(
+ { arrayBuffer },
+ { includeDefaultStyleMap: true },
+ );
+
+ const styledContent = result.value
+ .replace(/<p>/g, '<p class="mb-2">')
+ .replace(/<h(\d)>/g, '<h$1 class="font-semibold mt-4 mb-2">');
+
+ setHtmlContent(styledContent);
+ } catch (err) {
+ message.error('Document parsing failed');
+ console.error('Error parsing document:', err);
+ }
+ setLoading(false);
+ };
+
+ useEffect(() => {
+ if (url) {
+ fetchDocument();
+ }
+ }, [url]);
+ return (
+ <div
+ className={classNames(
+ 'relative w-full h-full p-4 bg-background-paper border border-border-normal rounded-md',
+ className,
+ )}
+ >
+ {loading && (
+ <div className="absolute inset-0 flex items-center justify-center">
+ <Spin />
+ </div>
+ )}
+
+ {!loading && <div dangerouslySetInnerHTML={{ __html: htmlContent }} />}
+ </div>
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/document-preview/document-header.tsx b/web/src/pages/dataflow-result/components/document-preview/document-header.tsx
new file mode 100644
index 0000000000..5ff971b3a3
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/document-header.tsx
@@ -0,0 +1,21 @@
+import { formatDate } from '@/utils/date';
+import { formatBytes } from '@/utils/file-util';
+
+type Props = {
+ size: number;
+ name: string;
+ create_date: string;
+};
+
+export default ({ size, name, create_date }: Props) => {
+ const sizeName = formatBytes(size);
+ const dateStr = formatDate(create_date);
+ return (
+ <div>
+ <h2 className="text-[16px]">{name}</h2>
+ <div className="text-text-secondary text-[12px] pt-[5px]">
+ Size:{sizeName} Uploaded Time:{dateStr}
+ </div>
+ </div>
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/document-preview/excel-preview.tsx b/web/src/pages/dataflow-result/components/document-preview/excel-preview.tsx
new file mode 100644
index 0000000000..c86e0462c0
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/excel-preview.tsx
@@ -0,0 +1,25 @@
+import { useFetchExcel } from '@/pages/document-viewer/hooks';
+import classNames from 'classnames';
+
+interface ExcelCsvPreviewerProps {
+ className?: string;
+ url: string;
+}
+
+export const ExcelCsvPreviewer: React.FC<ExcelCsvPreviewerProps> = ({
+ className,
+ url,
+}) => {
+ // const url = useGetDocumentUrl();
+ const { containerRef } = useFetchExcel(url);
+
+ return (
+ <div
+ ref={containerRef}
+ className={classNames(
+ 'relative w-full h-full p-4 bg-background-paper border border-border-normal rounded-md excel-csv-previewer',
+ className,
+ )}
+ ></div>
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/document-preview/hooks.ts b/web/src/pages/dataflow-result/components/document-preview/hooks.ts
new file mode 100644
index 0000000000..fcf6a01bab
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/hooks.ts
@@ -0,0 +1,55 @@
+import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
+import { api_host } from '@/utils/api';
+import { useSize } from 'ahooks';
+import { CustomTextRenderer } from 'node_modules/react-pdf/dist/esm/shared/types';
+import { useCallback, useEffect, useMemo, useState } from 'react';
+
+export const useDocumentResizeObserver = () => {
+ const [containerWidth, setContainerWidth] = useState<number>();
+ const [containerRef, setContainerRef] = useState<HTMLElement | null>(null);
+ const size = useSize(containerRef);
+
+ const onResize = useCallback((width?: number) => {
+ if (width) {
+ setContainerWidth(width);
+ }
+ }, []);
+
+ useEffect(() => {
+ onResize(size?.width);
+ }, [size?.width, onResize]);
+
+ return { containerWidth, setContainerRef };
+};
+
+function highlightPattern(text: string, pattern: string, pageNumber: number) {
+ if (pageNumber === 2) {
+ return `<mark>${text}</mark>`;
+ }
+ if (text.trim() !== '' && pattern.match(text)) {
+ // return pattern.replace(text, (value) => `<mark>${value}</mark>`);
+ return `<mark>${text}</mark>`;
+ }
+ return text.replace(pattern, (value) => `<mark>${value}</mark>`);
+}
+
+export const useHighlightText = (searchText: string = '') => {
+ const textRenderer: CustomTextRenderer = useCallback(
+ (textItem) => {
+ return highlightPattern(textItem.str, searchText, textItem.pageNumber);
+ },
+ [searchText],
+ );
+
+ return textRenderer;
+};
+
+export const useGetDocumentUrl = () => {
+ const { documentId } = useGetKnowledgeSearchParams();
+
+ const url = useMemo(() => {
+ return `${api_host}/document/get/${documentId}`;
+ }, [documentId]);
+
+ return url;
+};
diff --git a/web/src/pages/dataflow-result/components/document-preview/image-preview.tsx b/web/src/pages/dataflow-result/components/document-preview/image-preview.tsx
new file mode 100644
index 0000000000..80e796a54f
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/image-preview.tsx
@@ -0,0 +1,73 @@
+import message from '@/components/ui/message';
+import { Spin } from '@/components/ui/spin';
+import request from '@/utils/request';
+import classNames from 'classnames';
+import { useEffect, useState } from 'react';
+
+interface ImagePreviewerProps {
+ className?: string;
+ url: string;
+}
+
+export const ImagePreviewer: React.FC<ImagePreviewerProps> = ({
+ className,
+ url,
+}) => {
+ // const url = useGetDocumentUrl();
+ const [imageSrc, setImageSrc] = useState<string | null>(null);
+ const [isLoading, setIsLoading] = useState<boolean>(true);
+
+ const fetchImage = async () => {
+ setIsLoading(true);
+ const res = await request(url, {
+ method: 'GET',
+ responseType: 'blob',
+ onError: () => {
+ message.error('Failed to load image');
+ setIsLoading(false);
+ },
+ });
+ const objectUrl = URL.createObjectURL(res.data);
+ setImageSrc(objectUrl);
+ setIsLoading(false);
+ };
+ useEffect(() => {
+ if (url) {
+ fetchImage();
+ }
+ }, [url]);
+
+ useEffect(() => {
+ return () => {
+ if (imageSrc) {
+ URL.revokeObjectURL(imageSrc);
+ }
+ };
+ }, [imageSrc]);
+
+ return (
+ <div
+ className={classNames(
+ 'relative w-full h-full p-4 bg-background-paper border border-border-normal rounded-md image-previewer',
+ className,
+ )}
+ >
+ {isLoading && (
+ <div className="absolute inset-0 flex items-center justify-center">
+ <Spin />
+ </div>
+ )}
+
+ {!isLoading && imageSrc && (
+ <div className="max-h-[80vh] overflow-auto p-2">
+ <img
+ src={imageSrc}
+ alt={'image'}
+ className="w-full h-auto max-w-full object-contain"
+ onLoad={() => URL.revokeObjectURL(imageSrc!)}
+ />
+ </div>
+ )}
+ </div>
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/document-preview/index.less b/web/src/pages/dataflow-result/components/document-preview/index.less
new file mode 100644
index 0000000000..bbba51f093
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/index.less
@@ -0,0 +1,13 @@
+.documentContainer {
+ width: 100%;
+ // height: calc(100vh - 284px);
+ height: calc(100vh - 170px);
+ position: relative;
+ :global(.PdfHighlighter) {
+ overflow-x: hidden;
+ }
+ :global(.Highlight--scrolledTo .Highlight__part) {
+ overflow-x: hidden;
+ background-color: rgba(255, 226, 143, 1);
+ }
+}
diff --git a/web/src/pages/dataflow-result/components/document-preview/index.tsx b/web/src/pages/dataflow-result/components/document-preview/index.tsx
new file mode 100644
index 0000000000..dd7b353489
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/index.tsx
@@ -0,0 +1,68 @@
+import { memo } from 'react';
+
+import CSVFileViewer from './csv-preview';
+import { DocPreviewer } from './doc-preview';
+import { ExcelCsvPreviewer } from './excel-preview';
+import { ImagePreviewer } from './image-preview';
+import styles from './index.less';
+import PdfPreviewer, { IProps } from './pdf-preview';
+import { PptPreviewer } from './ppt-preview';
+import { TxtPreviewer } from './txt-preview';
+
+type PreviewProps = {
+ fileType: string;
+ className?: string;
+ url: string;
+};
+const Preview = ({
+ fileType,
+ className,
+ highlights,
+ setWidthAndHeight,
+ url,
+}: PreviewProps & Partial<IProps>) => {
+ return (
+ <>
+ {fileType === 'pdf' && highlights && setWidthAndHeight && (
+ <section className={styles.documentPreview}>
+ <PdfPreviewer
+ highlights={highlights}
+ setWidthAndHeight={setWidthAndHeight}
+ url={url}
+ ></PdfPreviewer>
+ </section>
+ )}
+ {['doc', 'docx'].indexOf(fileType) > -1 && (
+ <section>
+ <DocPreviewer className={className} url={url} />
+ </section>
+ )}
+ {['txt', 'md'].indexOf(fileType) > -1 && (
+ <section>
+ <TxtPreviewer className={className} url={url} />
+ </section>
+ )}
+ {['visual'].indexOf(fileType) > -1 && (
+ <section>
+ <ImagePreviewer className={className} url={url} />
+ </section>
+ )}
+ {['pptx'].indexOf(fileType) > -1 && (
+ <section>
+ <PptPreviewer className={className} url={url} />
+ </section>
+ )}
+ {['xlsx'].indexOf(fileType) > -1 && (
+ <section>
+ <ExcelCsvPreviewer className={className} url={url} />
+ </section>
+ )}
+ {['csv'].indexOf(fileType) > -1 && (
+ <section>
+ <CSVFileViewer className={className} url={url} />
+ </section>
+ )}
+ </>
+ );
+};
+export default memo(Preview);
diff --git a/web/src/pages/dataflow-result/components/document-preview/pdf-preview.tsx b/web/src/pages/dataflow-result/components/document-preview/pdf-preview.tsx
new file mode 100644
index 0000000000..79b1c54ae9
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/pdf-preview.tsx
@@ -0,0 +1,127 @@
+import { memo, useEffect, useRef } from 'react';
+import {
+ AreaHighlight,
+ Highlight,
+ IHighlight,
+ PdfHighlighter,
+ PdfLoader,
+ Popup,
+} from 'react-pdf-highlighter';
+
+import { useCatchDocumentError } from '@/components/pdf-previewer/hooks';
+import { Spin } from '@/components/ui/spin';
+import FileError from '@/pages/document-viewer/file-error';
+import styles from './index.less';
+
+export interface IProps {
+ highlights: IHighlight[];
+ setWidthAndHeight: (width: number, height: number) => void;
+ url: string;
+}
+const HighlightPopup = ({
+ comment,
+}: {
+ comment: { text: string; emoji: string };
+}) =>
+ comment.text ? (
+ <div className="Highlight__popup">
+ {comment.emoji} {comment.text}
+ </div>
+ ) : null;
+
+// TODO: merge with DocumentPreviewer
+const PdfPreview = ({ highlights: state, setWidthAndHeight, url }: IProps) => {
+ // const url = useGetDocumentUrl();
+
+ const ref = useRef<(highlight: IHighlight) => void>(() => {});
+ const error = useCatchDocumentError(url);
+
+ const resetHash = () => {};
+
+ useEffect(() => {
+ if (state.length > 0) {
+ ref?.current(state[0]);
+ }
+ }, [state]);
+
+ return (
+ <div
+ className={`${styles.documentContainer} rounded-[10px] overflow-hidden `}
+ >
+ <PdfLoader
+ url={url}
+ beforeLoad={
+ <div className="absolute inset-0 flex items-center justify-center">
+ <Spin />
+ </div>
+ }
+ workerSrc="/pdfjs-dist/pdf.worker.min.js"
+ errorMessage={<FileError>{error}</FileError>}
+ >
+ {(pdfDocument) => {
+ pdfDocument.getPage(1).then((page) => {
+ const viewport = page.getViewport({ scale: 1 });
+ const width = viewport.width;
+ const height = viewport.height;
+ setWidthAndHeight(width, height);
+ });
+
+ return (
+ <PdfHighlighter
+ pdfDocument={pdfDocument}
+ enableAreaSelection={(event) => event.altKey}
+ onScrollChange={resetHash}
+ scrollRef={(scrollTo) => {
+ ref.current = scrollTo;
+ }}
+ onSelectionFinished={() => null}
+ highlightTransform={(
+ highlight,
+ index,
+ setTip,
+ hideTip,
+ viewportToScaled,
+ screenshot,
+ isScrolledTo,
+ ) => {
+ const isTextHighlight = !Boolean(
+ highlight.content && highlight.content.image,
+ );
+
+ const component = isTextHighlight ? (
+ <Highlight
+ isScrolledTo={isScrolledTo}
+ position={highlight.position}
+ comment={highlight.comment}
+ />
+ ) : (
+ <AreaHighlight
+ isScrolledTo={isScrolledTo}
+ highlight={highlight}
+ onChange={() => {}}
+ />
+ );
+
+ return (
+ <Popup
+ popupContent={<HighlightPopup {...highlight} />}
+ onMouseOver={(popupContent) =>
+ setTip(highlight, () => popupContent)
+ }
+ onMouseOut={hideTip}
+ key={index}
+ >
+ {component}
+ </Popup>
+ );
+ }}
+ highlights={state}
+ />
+ );
+ }}
+ </PdfLoader>
+ </div>
+ );
+};
+
+export default memo(PdfPreview);
diff --git a/web/src/pages/dataflow-result/components/document-preview/ppt-preview.tsx b/web/src/pages/dataflow-result/components/document-preview/ppt-preview.tsx
new file mode 100644
index 0000000000..7786c48c3b
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/ppt-preview.tsx
@@ -0,0 +1,70 @@
+import message from '@/components/ui/message';
+import request from '@/utils/request';
+import classNames from 'classnames';
+import { init } from 'pptx-preview';
+import { useEffect, useRef } from 'react';
+interface PptPreviewerProps {
+ className?: string;
+ url: string;
+}
+
+export const PptPreviewer: React.FC<PptPreviewerProps> = ({
+ className,
+ url,
+}) => {
+ // const url = useGetDocumentUrl();
+ const wrapper = useRef<HTMLDivElement>(null);
+ const containerRef = useRef<HTMLDivElement>(null);
+ const fetchDocument = async () => {
+ const res = await request(url, {
+ method: 'GET',
+ responseType: 'blob',
+ onError: () => {
+ message.error('Document parsing failed');
+ console.error('Error loading document:', url);
+ },
+ });
+ console.log(res);
+ try {
+ const arrayBuffer = await res.data.arrayBuffer();
+
+ if (containerRef.current) {
+ let width = 500;
+ let height = 900;
+ if (containerRef.current) {
+ width = containerRef.current.clientWidth - 50;
+ height = containerRef.current.clientHeight - 50;
+ }
+ let pptxPrviewer = init(containerRef.current, {
+ width: width,
+ height: height,
+ });
+ pptxPrviewer.preview(arrayBuffer);
+ }
+ } catch (err) {
+ message.error('ppt parse failed');
+ }
+ };
+
+ useEffect(() => {
+ if (url) {
+ fetchDocument();
+ }
+ }, [url]);
+
+ return (
+ <div
+ ref={containerRef}
+ className={classNames(
+ 'relative w-full h-full p-4 bg-background-paper border border-border-normal rounded-md ppt-previewer',
+ className,
+ )}
+ >
+ <div className="overflow-auto p-2">
+ <div className="flex flex-col gap-4">
+ <div ref={wrapper} />
+ </div>
+ </div>
+ </div>
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/document-preview/txt-preview.tsx b/web/src/pages/dataflow-result/components/document-preview/txt-preview.tsx
new file mode 100644
index 0000000000..cf6649e343
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/document-preview/txt-preview.tsx
@@ -0,0 +1,56 @@
+import message from '@/components/ui/message';
+import { Spin } from '@/components/ui/spin';
+import request from '@/utils/request';
+import classNames from 'classnames';
+import { useEffect, useState } from 'react';
+
+type TxtPreviewerProps = { className?: string; url: string };
+export const TxtPreviewer = ({ className, url }: TxtPreviewerProps) => {
+ // const url = useGetDocumentUrl();
+ const [loading, setLoading] = useState(false);
+ const [data, setData] = useState<string>('');
+ const fetchTxt = async () => {
+ setLoading(true);
+ const res = await request(url, {
+ method: 'GET',
+ responseType: 'blob',
+ onError: (err: any) => {
+ message.error('Failed to load file');
+ console.error('Error loading file:', err);
+ },
+ });
+ // blob to string
+ const reader = new FileReader();
+ reader.readAsText(res.data);
+ reader.onload = () => {
+ setData(reader.result as string);
+ setLoading(false);
+ console.log('file loaded successfully', reader.result);
+ };
+ console.log('file data:', res);
+ };
+ useEffect(() => {
+ if (url) {
+ fetchTxt();
+ } else {
+ setLoading(false);
+ setData('');
+ }
+ }, [url]);
+ return (
+ <div
+ className={classNames(
+ 'relative w-full h-full p-4 bg-background-paper border border-border-normal rounded-md',
+ className,
+ )}
+ >
+ {loading && (
+ <div className="absolute inset-0 flex items-center justify-center">
+ <Spin />
+ </div>
+ )}
+
+ {!loading && <pre className="whitespace-pre-wrap p-2 ">{data}</pre>}
+ </div>
+ );
+};
diff --git a/web/src/pages/dataflow-result/components/parse-editer/index.tsx b/web/src/pages/dataflow-result/components/parse-editer/index.tsx
new file mode 100644
index 0000000000..2a748e910a
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/parse-editer/index.tsx
@@ -0,0 +1,48 @@
+import { Textarea } from '@/components/ui/textarea';
+import { cn } from '@/lib/utils';
+import { useState } from 'react';
+
+interface FormatPreserveEditorProps {
+ initialValue: string;
+ onSave: (value: string) => void;
+ className?: string;
+}
+const FormatPreserveEditor = ({
+ initialValue,
+ onSave,
+ className,
+}: FormatPreserveEditorProps) => {
+ const [content, setContent] = useState(initialValue);
+ const [isEditing, setIsEditing] = useState(false);
+
+ const handleEdit = () => setIsEditing(true);
+
+ const handleSave = () => {
+ onSave(content);
+ setIsEditing(false);
+ };
+
+ return (
+ <div className="editor-container">
+ {isEditing ? (
+ <Textarea
+ className={cn(
+ 'w-full h-full bg-transparent text-text-secondary',
+ className,
+ )}
+ value={content}
+ onChange={(e) => setContent(e.target.value)}
+ onBlur={handleSave}
+ autoSize={{ maxRows: 100 }}
+ autoFocus
+ />
+ ) : (
+ <pre className="text-text-secondary" onClick={handleEdit}>
+ {content}
+ </pre>
+ )}
+ </div>
+ );
+};
+
+export default FormatPreserveEditor;
diff --git a/web/src/pages/dataflow-result/components/rerun-button/index.tsx b/web/src/pages/dataflow-result/components/rerun-button/index.tsx
new file mode 100644
index 0000000000..72edc37955
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/rerun-button/index.tsx
@@ -0,0 +1,29 @@
+import SvgIcon from '@/components/svg-icon';
+import { Button } from '@/components/ui/button';
+import { CircleAlert } from 'lucide-react';
+import { useTranslation } from 'react-i18next';
+import { useRerunDataflow } from '../../hooks';
+interface RerunButtonProps {
+ className?: string;
+}
+const RerunButton = (props: RerunButtonProps) => {
+ const { t } = useTranslation();
+ const { loading } = useRerunDataflow();
+ const clickFunc = () => {
+ console.log('click rerun button');
+ };
+ return (
+ <div className="flex flex-col gap-2">
+ <div className="text-xs text-text-primary flex items-center gap-1">
+ <CircleAlert color="#d29e2d" strokeWidth={1} size={12} />
+ {t('dataflowParser.rerunFromCurrentStepTip')}
+ </div>
+ <Button onClick={clickFunc} disabled={loading}>
+ <SvgIcon name="rerun" width={16} />
+ {t('dataflowParser.rerunFromCurrentStep')}
+ </Button>
+ </div>
+ );
+};
+
+export default RerunButton;
diff --git a/web/src/pages/dataflow-result/components/time-line/index.tsx b/web/src/pages/dataflow-result/components/time-line/index.tsx
new file mode 100644
index 0000000000..75508a05f6
--- /dev/null
+++ b/web/src/pages/dataflow-result/components/time-line/index.tsx
@@ -0,0 +1,82 @@
+import { CustomTimeline, TimelineNode } from '@/components/originui/timeline';
+import {
+ CheckLine,
+ FilePlayIcon,
+ Grid3x2,
+ ListPlus,
+ PlayIcon,
+} from 'lucide-react';
+import { useMemo } from 'react';
+export const TimelineNodeObj = {
+ begin: {
+ id: 1,
+ title: 'Begin',
+ icon: <PlayIcon size={13} />,
+ clickable: false,
+ },
+ parser: { id: 2, title: 'Parser', icon: <FilePlayIcon size={13} /> },
+ chunker: { id: 3, title: 'Chunker', icon: <Grid3x2 size={13} /> },
+ indexer: {
+ id: 4,
+ title: 'Indexer',
+ icon: <ListPlus size={13} />,
+ clickable: false,
+ },
+ complete: {
+ id: 5,
+ title: 'Complete',
+ icon: <CheckLine size={13} />,
+ clickable: false,
+ },
+};
+
+export interface TimelineDataFlowProps {
+ activeId: number | string;
+ activeFunc: (id: number | string) => void;
+}
+const TimelineDataFlow = ({ activeFunc, activeId }: TimelineDataFlowProps) => {
+ // const [activeStep, setActiveStep] = useState(2);
+ const timelineNodes: TimelineNode[] = useMemo(() => {
+ const nodes: TimelineNode[] = [];
+ Object.keys(TimelineNodeObj).forEach((key) => {
+ nodes.push({
+ ...TimelineNodeObj[key as keyof typeof TimelineNodeObj],
+ className: 'w-32',
+ completed: false,
+ });
+ });
+ return nodes;
+ }, []);
+
+ const activeStep = useMemo(() => {
+ const index = timelineNodes.findIndex((node) => node.id === activeId);
+ return index > -1 ? index + 1 : 0;
+ }, [activeId, timelineNodes]);
+ const handleStepChange = (step: number, id: string | number) => {
+ // setActiveStep(step);
+ activeFunc?.(id);
+ console.log(step, id);
+ };
+
+ return (
+ <div className="">
+ <div>
+ <CustomTimeline
+ nodes={timelineNodes as TimelineNode[]}
+ activeStep={activeStep}
+ onStepChange={handleStepChange}
+ orientation="horizontal"
+ lineStyle="solid"
+ nodeSize={24}
+ activeStyle={{
+ nodeSize: 30,
+ iconColor: 'var(--accent-primary)',
+ textColor: 'var(--accent-primary)',
+ }}
+ />
+ </div>
+ </div>
+ );
+};
+
+export default TimelineDataFlow;
diff --git a/web/src/pages/dataflow-result/constant.ts b/web/src/pages/dataflow-result/constant.ts
new file mode 100644
index 0000000000..2093acb8de
--- /dev/null
+++ b/web/src/pages/dataflow-result/constant.ts
@@ -0,0 +1,4 @@
+export enum ChunkTextMode {
+ Full = 'full',
+ Ellipse = 'ellipse',
+}
diff --git a/web/src/pages/dataflow-result/hooks.ts b/web/src/pages/dataflow-result/hooks.ts
new file mode 100644
index 0000000000..be2dc1c01b
--- /dev/null
+++ b/web/src/pages/dataflow-result/hooks.ts
@@ -0,0 +1,185 @@
+import message from '@/components/ui/message';
+import {
+ useCreateChunk,
+ useDeleteChunk,
+ useSelectChunkList,
+} from '@/hooks/chunk-hooks';
+import { useSetModalState, useShowDeleteConfirm } from '@/hooks/common-hooks';
+import { useGetKnowledgeSearchParams } from '@/hooks/route-hook';
+import { IChunk } from '@/interfaces/database/knowledge';
+import { buildChunkHighlights } from '@/utils/document-util';
+import { useMutation, useQueryClient } from '@tanstack/react-query';
+import { useCallback, useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { IHighlight } from 'react-pdf-highlighter';
+import { ChunkTextMode } from './constant';
+
+export const useHandleChunkCardClick = () => {
+ const [selectedChunkId, setSelectedChunkId] = useState<string>('');
+
+ const handleChunkCardClick = useCallback((chunkId: string) => {
+ setSelectedChunkId(chunkId);
+ }, []);
+
+ return { handleChunkCardClick, selectedChunkId };
+};
+
+export const useGetSelectedChunk = (selectedChunkId: string) => {
+ const data = useSelectChunkList();
+ return (
+ data?.data?.find((x) => x.chunk_id === selectedChunkId) ?? ({} as IChunk)
+ );
+};
+
+export const useGetChunkHighlights = (selectedChunkId: string) => {
+ const [size, setSize] = useState({ width: 849, height: 1200 });
+ const selectedChunk: IChunk = useGetSelectedChunk(selectedChunkId);
+
+ const highlights: IHighlight[] = useMemo(() => {
+ return buildChunkHighlights(selectedChunk, size);
+ }, [selectedChunk, size]);
+
+ const setWidthAndHeight = useCallback((width: number, height: number) => {
+ setSize((pre) => {
+ if (pre.height !== height || pre.width !== width) {
+ return { height, width };
+ }
+ return pre;
+ });
+ }, []);
+
+ return { highlights, setWidthAndHeight };
+};
+
+// Switch chunk text to be fully displayed or ellipse
+export const useChangeChunkTextMode = () => {
+ const [textMode, setTextMode] = useState<ChunkTextMode>(ChunkTextMode.Full);
+
+ const changeChunkTextMode = useCallback((mode: ChunkTextMode) => {
+ setTextMode(mode);
+ }, []);
+
+ return { textMode, changeChunkTextMode };
+};
+
+export const useDeleteChunkByIds = (): {
+ removeChunk: (chunkIds: string[], documentId: string) => Promise<number>;
+} => {
+ const { deleteChunk } = useDeleteChunk();
+ const showDeleteConfirm = useShowDeleteConfirm();
+
+ const removeChunk = useCallback(
+ (chunkIds: string[], documentId: string) => () => {
+ return deleteChunk({ chunkIds, doc_id: documentId });
+ },
+ [deleteChunk],
+ );
+
+ const onRemoveChunk = useCallback(
+ (chunkIds: string[], documentId: string): Promise<number> => {
+ return showDeleteConfirm({ onOk: removeChunk(chunkIds, documentId) });
+ },
+ [removeChunk, showDeleteConfirm],
+ );
+
+ return {
+ removeChunk: onRemoveChunk,
+ };
+};
+
+export const useUpdateChunk = () => {
+ const [chunkId, setChunkId] = useState<string | undefined>('');
+ const {
+ visible: chunkUpdatingVisible,
+ hideModal: hideChunkUpdatingModal,
+ showModal,
+ } = useSetModalState();
+ const { createChunk, loading } = useCreateChunk();
+ const { documentId } = useGetKnowledgeSearchParams();
+
+ const onChunkUpdatingOk = useCallback(
+ async (params: IChunk) => {
+ const code = await createChunk({
+ ...params,
+ doc_id: documentId,
+ chunk_id: chunkId,
+ });
+
+ if (code === 0) {
+ hideChunkUpdatingModal();
+ }
+ },
+ [createChunk, hideChunkUpdatingModal, chunkId, documentId],
+ );
+
+ const handleShowChunkUpdatingModal = useCallback(
+ async (id?: string) => {
+ setChunkId(id);
+ showModal();
+ },
+ [showModal],
+ );
+
+ return {
+ chunkUpdatingLoading: loading,
+ onChunkUpdatingOk,
+ chunkUpdatingVisible,
+ hideChunkUpdatingModal,
+ showChunkUpdatingModal: handleShowChunkUpdatingModal,
+ chunkId,
+ documentId,
+ };
+};
+
+export const useFetchParserList = () => {
+ const [loading, setLoading] = useState(false);
+ return {
+ loading,
+ };
+};
+
+export const useRerunDataflow = () => {
+ const [loading, setLoading] = useState(false);
+ return {
+ loading,
+ };
+};
+
+export const useFetchPaserText = () => {
+ const initialText =
+ '第一行文本\n\t第二行缩进文本\n第三行 多个空格 第一行文本\n\t第二行缩进文本\n第三行 ' +
+ '多个空格第一行文本\n\t第二行缩进文本\n第三行 多个空格第一行文本\n\t第二行缩进文本\n第三行 ' +
+ '多个空格第一行文本\n\t第二行缩进文本\n第三行 多个空格第一行文本\n\t第二行缩进文本\n第三行 ' +
+ '多个空格第一行文本\n\t第二行缩进文本\n第三行 多个空格第一行文本\n\t第二行缩进文本\n第三行 ' +
+ '多个空格第一行文本\n\t第二行缩进文本\n第三行 多个空格第一行文本\n\t第二行缩进文本\n第三行 ' +
+ '多个空格第一行文本\n\t第二行缩进文本\n第三行 多个空格第一行文本\n\t第二行缩进文本\n第三行 ' +
+ '多个空格第一行文本\n\t第二行缩进文本\n第三行 多个空格第一行文本\n\t第二行缩进文本\n第三行 多个空格';
+ const [loading, setLoading] = useState(false);
+ const [data, setData] = useState<string>(initialText);
+ const { t } = useTranslation();
+ const queryClient = useQueryClient();
+
+ const {
+ // data,
+ // isPending: loading,
+ mutateAsync,
+ } = useMutation({
+ mutationKey: ['createChunk'],
+ mutationFn: async (payload: any) => {
+ // let service = kbService.create_chunk;
+ // if (payload.chunk_id) {
+ // service = kbService.set_chunk;
+ // }
+ // const { data } = await service(payload);
+ // if (data.code === 0) {
+ message.success(t('message.created'));
+ setTimeout(() => {
+ queryClient.invalidateQueries({ queryKey: ['fetchChunkList'] });
+ }, 1000); // Delay to ensure the list is updated
+ // }
+ // return data?.code;
+ },
+ });
+
+ return { data, loading, rerun: mutateAsync };
+};
diff --git a/web/src/pages/dataflow-result/index.less b/web/src/pages/dataflow-result/index.less
new file mode 100644
index 0000000000..9850fb4109
--- /dev/null
+++ b/web/src/pages/dataflow-result/index.less
@@ -0,0 +1,96 @@
+.chunkPage {
+ padding: 24px;
+ padding-top: 2px;
+
+ display: flex;
+ // height: calc(100vh - 112px);
+ height: 100vh;
+ flex-direction: column;
+
+ .filter {
+ margin: 10px 0;
+ display: flex;
+ height: 32px;
+ justify-content: space-between;
+ }
+
+ .pagePdfWrapper {
+ width: 60%;
+ }
+
+ .pageWrapper {
+ width: 100%;
+ }
+
+ .pageContent {
+ flex: 1;
+ width: 100%;
+ padding-right: 12px;
+ overflow-y: auto;
+
+ .spin {
+ min-height: 400px;
+ }
+ }
+
+ .documentPreview {
+ // width: 40%;
+ height: calc(100vh - 180px);
+ overflow: auto;
+ }
+
+ .chunkContainer {
+ display: flex;
+ height: calc(100vh - 332px);
+ }
+
+ .chunkOtherContainer {
+ width: 100%;
+ }
+
+ .pageFooter {
+ padding-top: 10px;
+ padding-right: 10px;
+ height: 32px;
+ }
+}
+
+.container {
+ height: 100px;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+
+ .content {
+ display: flex;
+ justify-content: space-between;
+
+ .context {
+ flex: 1;
+ // width: 207px;
+ height: 88px;
+ overflow: hidden;
+ }
+ }
+
+ .footer {
+ height: 20px;
+
+ .text {
+ margin-left: 10px;
+ }
+ }
+}
+
+.card {
+ :global {
+ .ant-card-body {
+ padding: 10px;
+ margin: 0;
+ }
+
+ margin-bottom: 10px;
+ }
+
+ cursor: pointer;
+}
diff --git a/web/src/pages/dataflow-result/index.tsx b/web/src/pages/dataflow-result/index.tsx
new file mode 100644
index 0000000000..f607f92660
--- /dev/null
+++ b/web/src/pages/dataflow-result/index.tsx
@@ -0,0 +1,121 @@
+import { useFetchNextChunkList } from '@/hooks/use-chunk-request';
+import { useMemo, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import DocumentPreview from './components/document-preview';
+import { useGetChunkHighlights, useHandleChunkCardClick } from './hooks';
+
+import DocumentHeader from './components/document-preview/document-header';
+
+import { PageHeader } from '@/components/page-header';
+import {
+ Breadcrumb,
+ BreadcrumbItem,
+ BreadcrumbLink,
+ BreadcrumbList,
+ BreadcrumbPage,
+ BreadcrumbSeparator,
+} from '@/components/ui/breadcrumb';
+import {
+ QueryStringMap,
+ useNavigatePage,
+} from '@/hooks/logic-hooks/navigate-hooks';
+import { useFetchKnowledgeBaseConfiguration } from '@/hooks/use-knowledge-request';
+import { ChunkerContainer } from './chunker';
+import { useGetDocumentUrl } from './components/document-preview/hooks';
+import TimelineDataFlow, { TimelineNodeObj } from './components/time-line';
+import styles from './index.less';
+import ParserContainer from './parser';
+
+const Chunk = () => {
+ const {
+ data: { documentInfo },
+ } = useFetchNextChunkList();
+ const { selectedChunkId } = useHandleChunkCardClick();
+ const [activeStepId, setActiveStepId] = useState<number | string>(0);
+ const { data: dataset } = useFetchKnowledgeBaseConfiguration();
+
+ const { t } = useTranslation();
+
+ const { navigateToDataset, getQueryString, navigateToDatasetList } =
+ useNavigatePage();
+ const fileUrl = useGetDocumentUrl();
+
+ const { highlights, setWidthAndHeight } =
+ useGetChunkHighlights(selectedChunkId);
+
+ const fileType = useMemo(() => {
+ switch (documentInfo?.type) {
+ case 'doc':
+ return documentInfo?.name.split('.').pop() || 'doc';
+ case 'visual':
+ case 'docx':
+ case 'txt':
+ case 'md':
+ case 'pdf':
+ return documentInfo?.type;
+ }
+ return 'unknown';
+ }, [documentInfo]);
+
+ const handleStepChange = (id: number | string) => {
+ setActiveStepId(id);
+ };
+ return (
+ <>
+ <PageHeader>
+ <Breadcrumb>
+ <BreadcrumbList>
+ <BreadcrumbItem>
+ <BreadcrumbLink onClick={navigateToDatasetList}>
+ {t('knowledgeDetails.dataset')}
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem>
+ <BreadcrumbLink
+ onClick={navigateToDataset(
+ getQueryString(QueryStringMap.id) as string,
+ )}
+ >
+ {dataset.name}
+ </BreadcrumbLink>
+ </BreadcrumbItem>
+ <BreadcrumbSeparator />
+ <BreadcrumbItem>
+ <BreadcrumbPage>{documentInfo?.name}</BreadcrumbPage>
+ </BreadcrumbItem>
+ </BreadcrumbList>
+ </Breadcrumb>
+ </PageHeader>
+ <div className=" absolute ml-[50%] translate-x-[-50%] top-4 flex justify-center">
+ <TimelineDataFlow
+ activeFunc={handleStepChange}
+ activeId={activeStepId}
+ />
+ </div>
+ <div className={styles.chunkPage}>
+ <div className="flex flex-none gap-8 border border-border mt-[26px] p-3 rounded-lg h-[calc(100vh-100px)]">
+ <div className="w-2/5">
+ <div className="h-[50px] flex flex-col justify-end pb-[5px]">
+ <DocumentHeader {...documentInfo} />
+ </div>
+ <section className={styles.documentPreview}>
+ <DocumentPreview
+ className={styles.documentPreview}
+ fileType={fileType}
+ highlights={highlights}
+ setWidthAndHeight={setWidthAndHeight}
+ url={fileUrl}
+ ></DocumentPreview>
+ </section>
+ </div>
+ <div className="h-dvh border-r -mt-3"></div>
+ {activeStepId === TimelineNodeObj.chunker.id && <ChunkerContainer />}
+ {activeStepId === TimelineNodeObj.parser.id && <ParserContainer />}
+ </div>
+ </div>
+ </>
+ );
+};
+
+export default Chunk;
diff --git a/web/src/pages/dataflow-result/parser.tsx b/web/src/pages/dataflow-result/parser.tsx
new file mode 100644
index 0000000000..d6d278a957
--- /dev/null
+++ b/web/src/pages/dataflow-result/parser.tsx
@@ -0,0 +1,58 @@
+import Spotlight from '@/components/spotlight';
+import { Spin } from '@/components/ui/spin';
+import classNames from 'classnames';
+import { useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import FormatPreserveEditor from './components/parse-editer';
+import RerunButton from './components/rerun-button';
+import { useFetchParserList, useFetchPaserText } from './hooks';
+const ParserContainer = () => {
+ const { data: initialValue, rerun: onSave } = useFetchPaserText();
+ const { t } = useTranslation();
+ const { loading } = useFetchParserList();
+
+ const [initialText, setInitialText] = useState(initialValue);
+ const [isChange, setIsChange] = useState(false);
+ const handleSave = (newContent: string) => {
+ console.log('保存内容:', newContent);
+ if (newContent !== initialText) {
+ setIsChange(true);
+ onSave(newContent);
+ } else {
+ setIsChange(false);
+ }
+ // Here, the API is called to send newContent to the backend
+ };
+ return (
+ <>
+ {isChange && (
+ <div className=" absolute top-2 right-6">
+ <RerunButton />
+ </div>
+ )}
+ <div className={classNames('flex flex-col w-3/5')}>
+ <Spin spinning={loading} className="" size="large">
+ <div className="h-[50px] flex flex-col justify-end pb-[5px]">
+ <div>
+ <h2 className="text-[16px]">
+ {t('dataflowParser.parseSummary')}
+ </h2>
+ <div className="text-[12px] text-text-secondary italic ">
+ {t('dataflowParser.parseSummaryTip')}
+ </div>
+ </div>
+ </div>
+ <div className=" border rounded-lg p-[20px] box-border h-[calc(100vh-180px)] overflow-auto scrollbar-none">
+ <FormatPreserveEditor
+ initialValue={initialText}
+ onSave={handleSave}
+ className="!h-[calc(100vh-220px)]"
+ />
+ <Spotlight opcity={0.6} coverage={60} />
+ </div>
+ </Spin>
+ </div>
+ </>
+ );
+};
+export default ParserContainer;
diff --git a/web/src/pages/dataflow-result/utils.ts b/web/src/pages/dataflow-result/utils.ts
new file mode 100644
index 0000000000..9284828a70
--- /dev/null
+++ b/web/src/pages/dataflow-result/utils.ts
@@ -0,0 +1,24 @@
+export type FormListItem = {
+ frequency: number;
+ tag: string;
+};
+
+export function transformTagFeaturesArrayToObject(
+ list: Array<FormListItem> = [],
+) {
+ return list.reduce<Record<string, number>>((pre, cur) => {
+ pre[cur.tag] = cur.frequency;
+
+ return pre;
+ }, {});
+}
+
+export function transformTagFeaturesObjectToArray(
+ object: Record<string, number> = {},
+) {
+ return Object.keys(object).reduce<Array<FormListItem>>((pre, key) => {
+ pre.push({ frequency: object[key], tag: key });
+
+ return pre;
+ }, []);
+}
diff --git a/web/src/pages/dataset/dataset-overview/dataset-common.ts b/web/src/pages/dataset/dataset-overview/dataset-common.ts
new file mode 100644
index 0000000000..9581ff6b6f
--- /dev/null
+++ b/web/src/pages/dataset/dataset-overview/dataset-common.ts
@@ -0,0 +1,9 @@
+export enum LogTabs {
+ FILE_LOGS = 'fileLogs',
+ DATASET_LOGS = 'datasetLogs',
+}
+
+export enum processingType {
+ knowledgeGraph = 'knowledgeGraph',
+ raptor = 'raptor',
+}
diff --git a/web/src/pages/dataset/dataset-overview/dataset-filter.tsx b/web/src/pages/dataset/dataset-overview/dataset-filter.tsx
new file mode 100644
index 0000000000..4767ce5d71
--- /dev/null
+++ b/web/src/pages/dataset/dataset-overview/dataset-filter.tsx
@@ -0,0 +1,91 @@
+import { FilterButton } from '@/components/list-filter-bar';
+import {
+ CheckboxFormMultipleProps,
+ FilterPopover,
+} from '@/components/list-filter-bar/filter-popover';
+import { Button } from '@/components/ui/button';
+import { SearchInput } from '@/components/ui/input';
+import { cn } from '@/lib/utils';
+import { ChangeEventHandler, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+import { LogTabs } from './dataset-common';
+
+interface IProps {
+ searchString?: string;
+ onSearchChange?: ChangeEventHandler<HTMLInputElement>;
+ active?: (typeof LogTabs)[keyof typeof LogTabs];
+ setActive?: (active: (typeof LogTabs)[keyof typeof LogTabs]) => void;
+}
+const DatasetFilter = (
+ props: IProps & Omit<CheckboxFormMultipleProps, 'setOpen'>,
+) => {
+ const {
+ searchString,
+ onSearchChange,
+ value,
+ onChange,
+ filters,
+ onOpenChange,
+ active = LogTabs.FILE_LOGS,
+ setActive,
+ ...rest
+ } = props;
+ const { t } = useTranslation();
+ const filterCount = useMemo(() => {
+ return typeof value === 'object' && value !== null
+ ? Object.values(value).reduce((pre, cur) => {
+ return pre + cur.length;
+ }, 0)
+ : 0;
+ }, [value]);
+ return (
+ <div className="flex items-center justify-between mb-4">
+ <div className="flex space-x-2 bg-bg-card p-1 rounded-md">
+ <Button
+ className={cn(
+ 'px-4 py-2 rounded-md hover:text-text-primary hover:bg-bg-base',
+ {
+ 'bg-bg-base text-text-primary': active === LogTabs.FILE_LOGS,
+ 'bg-transparent text-text-secondary ':
+ active !== LogTabs.FILE_LOGS,
+ },
+ )}
+ onClick={() => setActive?.(LogTabs.FILE_LOGS)}
+ >
+ {t('knowledgeDetails.fileLogs')}
+ </Button>
+ <Button
+ className={cn(
+ 'px-4 py-2 rounded-md hover:text-text-primary hover:bg-bg-base',
+ {
+ 'bg-bg-base text-text-primary': active === LogTabs.DATASET_LOGS,
+ 'bg-transparent text-text-secondary ':
+ active !== LogTabs.DATASET_LOGS,
+ },
+ )}
+ onClick={() => setActive?.(LogTabs.DATASET_LOGS)}
+ >
+ {t('knowledgeDetails.datasetLogs')}
+ </Button>
+ </div>
+ <div className="flex items-center space-x-2">
+ <FilterPopover
+ value={value}
+ onChange={onChange}
+ filters={filters}
+ onOpenChange={onOpenChange}
+ >
+ <FilterButton count={filterCount}></FilterButton>
+ </FilterPopover>
+
+ <SearchInput
+ value={searchString}
+ onChange={onSearchChange}
+ className="w-32"
+ ></SearchInput>
+ </div>
+ </div>
+ );
+};
+
+export { DatasetFilter };
diff --git a/web/src/pages/dataset/dataset-overview/index.tsx b/web/src/pages/dataset/dataset-overview/index.tsx
new file mode 100644
index 0000000000..ce1ab29b33
--- /dev/null
+++ b/web/src/pages/dataset/dataset-overview/index.tsx
@@ -0,0 +1,156 @@
+import {
+ CircleQuestionMark,
+ Cpu,
+ FileChartLine,
+ HardDriveDownload,
+} from 'lucide-react';
+import { FC, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { LogTabs } from './dataset-common';
+import { DatasetFilter } from './dataset-filter';
+import FileLogsTable from './overview-table';
+
+interface StatCardProps {
+ title: string;
+ value: number;
+ icon: JSX.Element;
+ children?: JSX.Element;
+}
+
+const StatCard: FC<StatCardProps> = ({ title, value, children, icon }) => {
+ return (
+ <div className="bg-bg-card p-4 rounded-lg border border-border flex flex-col gap-2">
+ <div className="flex items-center justify-between">
+ <h3 className="flex items-center gap-1 text-sm font-medium text-text-secondary">
+ {title}
+ <CircleQuestionMark size={12} />
+ </h3>
+ {icon}
+ </div>
+ <div className="text-2xl font-bold text-text-primary">{value}</div>
+ <div className="h-12 w-full flex items-center">
+ <div className="flex-1">{children}</div>
+ </div>
+ </div>
+ );
+};
+
+interface CardFooterProcessProps {
+ total: number;
+ completed: number;
+ success: number;
+ failed: number;
+}
+const CardFooterProcess: FC<CardFooterProcessProps> = ({
+ total,
+ completed,
+ success,
+ failed,
+}) => {
+ const { t } = useTranslation();
+ const successPrecentage = (success / total) * 100;
+ const failedPrecentage = (failed / total) * 100;
+ return (
+ <div className="flex items-center flex-col gap-2">
+ <div className="flex justify-between w-full text-sm text-text-secondary">
+ <div className="flex items-center gap-2">
+ <div className="flex items-center gap-1">
+ {success}
+ <span>{t('knowledgeDetails.success')}</span>
+ </div>
+ <div className="flex items-center gap-1">
+ {failed}
+ <span>{t('knowledgeDetails.failed')}</span>
+ </div>
+ </div>
+ <div className="flex items-center gap-1">
+ {completed}
+ <span>{t('knowledgeDetails.completed')}</span>
+ </div>
+ </div>
+ <div className="w-full flex rounded-full h-3 bg-bg-card text-sm font-bold text-text-primary">
+ <div
+ className=" rounded-full h-3 bg-accent-primary"
+ style={{ width: successPrecentage + '%' }}
+ ></div>
+ <div
+ className=" rounded-full h-3 bg-state-error"
+ style={{ width: failedPrecentage + '%' }}
+ ></div>
+ </div>
+ </div>
+ );
+};
+const FileLogsPage: FC = () => {
+ const { t } = useTranslation();
+ const [active, setActive] = useState<(typeof LogTabs)[keyof typeof LogTabs]>(
+ LogTabs.FILE_LOGS,
+ );
+ const mockData = Array(30)
+ .fill(0)
+ .map((_, i) => ({
+ id: i === 0 ? '#952734' : `14`,
+ fileName: 'PRD for DealBees 1.2 (1).txt',
+ source: 'GitHub',
+ pipeline: i === 0 ? 'data demo for...' : i === 1 ? 'test' : 'kiki’s demo',
+ startDate: '14/03/2025 14:53:39',
+ task: i === 0 ? 'Parse' : 'Parser',
+ status:
+ i === 0
+ ? 'Success'
+ : i === 1
+ ? 'Failed'
+ : i === 2
+ ? 'Running'
+ : 'Pending',
+ }));
+
+ const pagination = {
+ current: 1,
+ pageSize: 30,
+ total: 100,
+ };
+
+ const changeActiveLogs = (active: (typeof LogTabs)[keyof typeof LogTabs]) => {
+ setActive(active);
+ };
+ const handlePaginationChange = (page: number, pageSize: number) => {
+ console.log('Pagination changed:', { page, pageSize });
+ };
+
+ return (
+ <div className="p-5 min-w-[880px] border-border border rounded-lg mr-5">
+ {/* Stats Cards */}
+ <div className="grid grid-cols-3 md:grid-cols-3 gap-4 mb-6">
+ <StatCard title="Total Files" value={2827} icon={<FileChartLine />}>
+ <div>+7% from last week</div>
+ </StatCard>
+ <StatCard title="Downloading" value={28} icon={<HardDriveDownload />}>
+ <CardFooterProcess
+ total={100}
+ success={8}
+ failed={2}
+ completed={15}
+ />
+ </StatCard>
+ <StatCard title="Processing" value={156} icon={<Cpu />}>
+ <CardFooterProcess total={20} success={8} failed={2} completed={15} />
+ </StatCard>
+ </div>
+
+ {/* Tabs & Search */}
+ <DatasetFilter active={active} setActive={changeActiveLogs} />
+
+ {/* Table */}
+ <FileLogsTable
+ data={mockData}
+ pagination={pagination}
+ setPagination={handlePaginationChange}
+ pageCount={10}
+ active={active}
+ />
+ </div>
+ );
+};
+
+export default FileLogsPage;
diff --git a/web/src/pages/dataset/dataset-overview/overview-table.tsx b/web/src/pages/dataset/dataset-overview/overview-table.tsx
new file mode 100644
index 0000000000..d02eae6154
--- /dev/null
+++ b/web/src/pages/dataset/dataset-overview/overview-table.tsx
@@ -0,0 +1,384 @@
+import FileStatusBadge from '@/components/file-status-badge';
+import { FileIcon } from '@/components/icon-font';
+import { RAGFlowAvatar } from '@/components/ragflow-avatar';
+import SvgIcon from '@/components/svg-icon';
+import { Button } from '@/components/ui/button';
+import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@/components/ui/table';
+import { useTranslate } from '@/hooks/common-hooks';
+import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
+import ProcessLogModal from '@/pages/datasets/process-log-modal';
+import {
+ ColumnDef,
+ ColumnFiltersState,
+ SortingState,
+ flexRender,
+ getCoreRowModel,
+ getFilteredRowModel,
+ getPaginationRowModel,
+ getSortedRowModel,
+ useReactTable,
+} from '@tanstack/react-table';
+import { TFunction } from 'i18next';
+import { ClipboardList, Eye } from 'lucide-react';
+import { Dispatch, FC, SetStateAction, useMemo, useState } from 'react';
+import { LogTabs, processingType } from './dataset-common';
+
+interface DocumentLog {
+ id: string;
+ fileName: string;
+ source: string;
+ pipeline: string;
+ startDate: string;
+ task: string;
+ status: 'Success' | 'Failed' | 'Running' | 'Pending';
+}
+
+interface FileLogsTableProps {
+ data: DocumentLog[];
+ pageCount: number;
+ pagination: {
+ current: number;
+ pageSize: number;
+ total: number;
+ };
+ setPagination: (pagination: { page: number; pageSize: number }) => void;
+ loading?: boolean;
+ active: (typeof LogTabs)[keyof typeof LogTabs];
+}
+
+export const getFileLogsTableColumns = (
+ t: TFunction<'translation', string>,
+ setIsModalVisible: Dispatch<SetStateAction<boolean>>,
+ navigateToDataflowResult: (
+ id: string,
+ knowledgeId?: string | undefined,
+ ) => () => void,
+) => {
+ // const { t } = useTranslate('knowledgeDetails');
+ const columns: ColumnDef<DocumentLog>[] = [
+ {
+ id: 'select',
+ header: ({ table }) => (
+ <input
+ type="checkbox"
+ checked={table.getIsAllRowsSelected()}
+ onChange={table.getToggleAllRowsSelectedHandler()}
+ className="rounded bg-gray-900 text-blue-500 focus:ring-blue-500"
+ />
+ ),
+ cell: ({ row }) => (
+ <input
+ type="checkbox"
+ checked={row.getIsSelected()}
+ onChange={row.getToggleSelectedHandler()}
+ className="rounded border-gray-600 bg-gray-900 text-blue-500 focus:ring-blue-500"
+ />
+ ),
+ },
+ {
+ accessorKey: 'id',
+ header: 'ID',
+ cell: ({ row }) => (
+ <div className="text-text-primary">{row.original.id}</div>
+ ),
+ },
+ {
+ accessorKey: 'fileName',
+ header: t('fileName'),
+ cell: ({ row }) => (
+ <div
+ className="flex items-center gap-2 text-text-primary"
+ onClick={navigateToDataflowResult(
+ row.original.id,
+ row.original.kb_id,
+ )}
+ >
+ <FileIcon name={row.original.fileName}></FileIcon>
+ {row.original.fileName}
+ </div>
+ ),
+ },
+ {
+ accessorKey: 'source',
+ header: t('source'),
+ cell: ({ row }) => (
+ <div className="text-text-primary">{row.original.source}</div>
+ ),
+ },
+ {
+ accessorKey: 'pipeline',
+ header: t('dataPipeline'),
+ cell: ({ row }) => (
+ <div className="flex items-center gap-2 text-text-primary">
+ <RAGFlowAvatar
+ avatar={null}
+ name={row.original.pipeline}
+ className="size-4"
+ />
+ {row.original.pipeline}
+ </div>
+ ),
+ },
+ {
+ accessorKey: 'startDate',
+ header: t('startDate'),
+ cell: ({ row }) => (
+ <div className="text-text-primary">{row.original.startDate}</div>
+ ),
+ },
+ {
+ accessorKey: 'task',
+ header: t('task'),
+ cell: ({ row }) => (
+ <div className="text-text-primary">{row.original.task}</div>
+ ),
+ },
+ {
+ accessorKey: 'status',
+ header: t('status'),
+ cell: ({ row }) => <FileStatusBadge status={row.original.status} />,
+ },
+ {
+ id: 'operations',
+ header: t('operations'),
+ cell: ({ row }) => (
+ <div className="flex justify-start space-x-2">
+ <Button
+ variant="ghost"
+ size="sm"
+ className="p-1"
+ onClick={() => {
+ setIsModalVisible(true);
+ }}
+ >
+ <Eye />
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="p-1"
+ onClick={navigateToDataflowResult(row.original.id)}
+ >
+ <ClipboardList />
+ </Button>
+ </div>
+ ),
+ },
+ ];
+
+ return columns;
+};
+
+export const getDatasetLogsTableColumns = (
+ t: TFunction<'translation', string>,
+ setIsModalVisible: Dispatch<SetStateAction<boolean>>,
+) => {
+ // const { t } = useTranslate('knowledgeDetails');
+ const columns: ColumnDef<DocumentLog>[] = [
+ {
+ id: 'select',
+ header: ({ table }) => (
+ <input
+ type="checkbox"
+ checked={table.getIsAllRowsSelected()}
+ onChange={table.getToggleAllRowsSelectedHandler()}
+ className="rounded bg-gray-900 text-blue-500 focus:ring-blue-500"
+ />
+ ),
+ cell: ({ row }) => (
+ <input
+ type="checkbox"
+ checked={row.getIsSelected()}
+ onChange={row.getToggleSelectedHandler()}
+ className="rounded border-gray-600 bg-gray-900 text-blue-500 focus:ring-blue-500"
+ />
+ ),
+ },
+ {
+ accessorKey: 'id',
+ header: 'ID',
+ cell: ({ row }) => (
+ <div className="text-text-primary">{row.original.id}</div>
+ ),
+ },
+ {
+ accessorKey: 'startDate',
+ header: t('startDate'),
+ cell: ({ row }) => (
+ <div className="text-text-primary">{row.original.startDate}</div>
+ ),
+ },
+ {
+ accessorKey: 'processingType',
+ header: t('processingType'),
+ cell: ({ row }) => (
+ <div className="flex items-center gap-2 text-text-primary">
+ {processingType.knowledgeGraph === row.original.processingType && (
+ <SvgIcon name={`data-flow/knowledgegraph`} width={24}></SvgIcon>
+ )}
+ {processingType.raptor === row.original.processingType && (
+ <SvgIcon name={`data-flow/raptor`} width={24}></SvgIcon>
+ )}
+ {row.original.processingType}
+ </div>
+ ),
+ },
+ {
+ accessorKey: 'status',
+ header: t('status'),
+ cell: ({ row }) => <FileStatusBadge status={row.original.status} />,
+ },
+ {
+ id: 'operations',
+ header: t('operations'),
+ cell: ({ row }) => (
+ <div className="flex justify-start space-x-2">
+ <Button
+ variant="ghost"
+ size="sm"
+ className="p-1"
+ onClick={() => {
+ setIsModalVisible(true);
+ }}
+ >
+ <Eye />
+ </Button>
+ </div>
+ ),
+ },
+ ];
+
+ return columns;
+};
+
+const FileLogsTable: FC<FileLogsTableProps> = ({
+ data,
+ pagination,
+ setPagination,
+ loading,
+ active = LogTabs.FILE_LOGS,
+}) => {
+ const [sorting, setSorting] = useState<SortingState>([]);
+ const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
+ const [rowSelection, setRowSelection] = useState({});
+ const { t } = useTranslate('knowledgeDetails');
+ const [isModalVisible, setIsModalVisible] = useState(false);
+ const { navigateToDataflowResult } = useNavigatePage();
+ const columns = useMemo(() => {
+ console.log('columns', active);
+ return active === LogTabs.FILE_LOGS
+ ? getFileLogsTableColumns(t, setIsModalVisible, navigateToDataflowResult)
+ : getDatasetLogsTableColumns(t, setIsModalVisible);
+ }, [active, t]);
+
+ const currentPagination = useMemo(
+ () => ({
+ pageIndex: (pagination.current || 1) - 1,
+ pageSize: pagination.pageSize || 10,
+ }),
+ [pagination],
+ );
+
+ const table = useReactTable({
+ data,
+ columns,
+ manualPagination: true,
+ getCoreRowModel: getCoreRowModel(),
+ getPaginationRowModel: getPaginationRowModel(),
+ getSortedRowModel: getSortedRowModel(),
+ getFilteredRowModel: getFilteredRowModel(),
+ onSortingChange: setSorting,
+ onColumnFiltersChange: setColumnFilters,
+ onRowSelectionChange: setRowSelection,
+ state: {
+ sorting,
+ columnFilters,
+ rowSelection,
+ pagination: currentPagination,
+ },
+ pageCount: pagination.total
+ ? Math.ceil(pagination.total / pagination.pageSize)
+ : 0,
+ });
+ const taskInfo = {
+ taskId: '#9527',
+ fileName: 'PRD for DealBees 1.2 (1).text',
+ fileSize: '2.4G',
+ source: 'Github',
+ task: 'Parse',
+ state: 'Running',
+ startTime: '14/03/2025 14:53:39',
+ duration: '800',
+ details: 'PRD for DealBees 1.2 (1).text',
+ };
+ return (
+ <div className="w-full h-[calc(100vh-350px)]">
+ <Table rootClassName="max-h-[calc(100vh-380px)]">
+ <TableHeader>
+ {table.getHeaderGroups().map((headerGroup) => (
+ <TableRow key={headerGroup.id}>
+ {headerGroup.headers.map((header) => (
+ <TableHead key={header.id}>
+ {flexRender(
+ header.column.columnDef.header,
+ header.getContext(),
+ )}
+ </TableHead>
+ ))}
+ </TableRow>
+ ))}
+ </TableHeader>
+ <TableBody className="relative">
+ {table.getRowModel().rows.length ? (
+ table.getRowModel().rows.map((row) => (
+ <TableRow
+ key={row.id}
+ data-state={row.getIsSelected() && 'selected'}
+ className="group"
+ >
+ {row.getVisibleCells().map((cell) => (
+ <TableCell
+ key={cell.id}
+ className={cell.column.columnDef.meta?.cellClassName}
+ >
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
+ </TableCell>
+ ))}
+ </TableRow>
+ ))
+ ) : (
+ <TableRow>
+ <TableCell colSpan={columns.length} className="h-24 text-center">
+ No results.
+ </TableCell>
+ </TableRow>
+ )}
+ </TableBody>
+ </Table>
+ <div className="flex items-center justify-end py-4 absolute bottom-3 right-12">
+ <div className="space-x-2">
+ <RAGFlowPagination
+ {...{ current: pagination.current, pageSize: pagination.pageSize }}
+ total={pagination.total}
+ onChange={(page, pageSize) => setPagination({ page, pageSize })}
+ />
+ </div>
+ </div>
+ <ProcessLogModal
+ visible={isModalVisible}
+ onCancel={() => setIsModalVisible(false)}
+ taskInfo={taskInfo}
+ />
+ </div>
+ );
+};
+
+export default FileLogsTable;
diff --git a/web/src/pages/dataset/dataset-setting/chunk-method-form.tsx b/web/src/pages/dataset/dataset-setting/chunk-method-form.tsx
new file mode 100644
index 0000000000..62462a29d6
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/chunk-method-form.tsx
@@ -0,0 +1,31 @@
+import { Button } from '@/components/ui/button';
+import { useFormContext } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+
+import { NaiveConfiguration } from './naive';
+import { SavingButton } from './saving-button';
+
+export function ChunkMethodForm() {
+ const form = useFormContext();
+ const { t } = useTranslation();
+
+ return (
+ <section className="h-full flex flex-col">
+ <div className="overflow-auto flex-1 min-h-0">
+ <NaiveConfiguration></NaiveConfiguration>
+ </div>
+ <div className="text-right pt-4 flex justify-end gap-3">
+ <Button
+ type="reset"
+ className="bg-transparent text-color-white hover:bg-transparent border-gray-500 border-[1px]"
+ onClick={() => {
+ form.reset();
+ }}
+ >
+ {t('knowledgeConfiguration.cancel')}
+ </Button>
+ <SavingButton></SavingButton>
+ </div>
+ </section>
+ );
+}
diff --git a/web/src/pages/dataset/dataset-setting/components/tag-item.tsx b/web/src/pages/dataset/dataset-setting/components/tag-item.tsx
new file mode 100644
index 0000000000..c5ccecca47
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/components/tag-item.tsx
@@ -0,0 +1,155 @@
+import { RAGFlowAvatar } from '@/components/ragflow-avatar';
+import { SliderInputFormField } from '@/components/slider-input-form-field';
+import {
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from '@/components/ui/form';
+import { MultiSelect } from '@/components/ui/multi-select';
+import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
+import { Flex, Form, InputNumber, Select, Slider, Space } from 'antd';
+import DOMPurify from 'dompurify';
+import { useFormContext, useWatch } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+
+export const TagSetItem = () => {
+ const { t } = useTranslation();
+ const form = useFormContext();
+
+ const { list: knowledgeList } = useFetchKnowledgeList(true);
+
+ const knowledgeOptions = knowledgeList
+ .filter((x) => x.parser_id === 'tag')
+ .map((x) => ({
+ label: x.name,
+ value: x.id,
+ icon: () => (
+ <Space>
+ <RAGFlowAvatar
+ name={x.name}
+ avatar={x.avatar}
+ className="size-4"
+ ></RAGFlowAvatar>
+ </Space>
+ ),
+ }));
+
+ return (
+ <FormField
+ control={form.control}
+ name="parser_config.tag_kb_ids"
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="flex items-center">
+ <FormLabel
+ className="text-sm text-muted-foreground whitespace-nowrap w-1/4"
+ tooltip={
+ <div
+ dangerouslySetInnerHTML={{
+ __html: DOMPurify.sanitize(
+ t('knowledgeConfiguration.tagSetTip'),
+ ),
+ }}
+ ></div>
+ }
+ >
+ {t('knowledgeConfiguration.tagSet')}
+ </FormLabel>
+ <div className="w-3/4">
+ <FormControl>
+ <MultiSelect
+ options={knowledgeOptions}
+ onValueChange={field.onChange}
+ placeholder={t('chat.knowledgeBasesMessage')}
+ variant="inverted"
+ maxCount={10}
+ {...field}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+
+ return (
+ <Form.Item
+ label={t('knowledgeConfiguration.tagSet')}
+ name={['parser_config', 'tag_kb_ids']}
+ tooltip={
+ <div
+ dangerouslySetInnerHTML={{
+ __html: DOMPurify.sanitize(t('knowledgeConfiguration.tagSetTip')),
+ }}
+ ></div>
+ }
+ rules={[
+ {
+ message: t('chat.knowledgeBasesMessage'),
+ type: 'array',
+ },
+ ]}
+ >
+ <Select
+ mode="multiple"
+ options={knowledgeOptions}
+ placeholder={t('chat.knowledgeBasesMessage')}
+ ></Select>
+ </Form.Item>
+ );
+};
+
+export const TopNTagsItem = () => {
+ const { t } = useTranslation();
+
+ return (
+ <SliderInputFormField
+ name={'parser_config.topn_tags'}
+ label={t('knowledgeConfiguration.topnTags')}
+ max={10}
+ min={1}
+ defaultValue={3}
+ ></SliderInputFormField>
+ );
+
+ return (
+ <Form.Item label={t('knowledgeConfiguration.topnTags')}>
+ <Flex gap={20} align="center">
+ <Flex flex={1}>
+ <Form.Item
+ name={['parser_config', 'topn_tags']}
+ noStyle
+ initialValue={3}
+ >
+ <Slider max={10} min={1} style={{ width: '100%' }} />
+ </Form.Item>
+ </Flex>
+ <Form.Item name={['parser_config', 'topn_tags']} noStyle>
+ <InputNumber max={10} min={1} />
+ </Form.Item>
+ </Flex>
+ </Form.Item>
+ );
+};
+
+export function TagItems() {
+ const form = useFormContext();
+ const ids: string[] = useWatch({
+ control: form.control,
+ name: 'parser_config.tag_kb_ids',
+ });
+
+ return (
+ <>
+ <TagSetItem></TagSetItem>
+ {Array.isArray(ids) && ids.length > 0 && <TopNTagsItem></TopNTagsItem>}
+ </>
+ );
+}
diff --git a/web/src/pages/dataset/dataset-setting/configuration-form-container.tsx b/web/src/pages/dataset/dataset-setting/configuration-form-container.tsx
new file mode 100644
index 0000000000..93e30ffb7d
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/configuration-form-container.tsx
@@ -0,0 +1,14 @@
+import { FormContainerProps } from '@/components/form-container';
+import { cn } from '@/lib/utils';
+import { PropsWithChildren } from 'react';
+
+export function ConfigurationFormContainer({
+ children,
+ className,
+}: FormContainerProps) {
+ return <section className={cn('space-y-4', className)}>{children}</section>;
+}
+
+export function MainContainer({ children }: PropsWithChildren) {
+ return <section className="space-y-5">{children}</section>;
+}
diff --git a/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx
new file mode 100644
index 0000000000..8b2e3c5899
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/configuration/common-item.tsx
@@ -0,0 +1,328 @@
+import {
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from '@/components/ui/form';
+import { Radio } from '@/components/ui/radio';
+import { RAGFlowSelect } from '@/components/ui/select';
+import { Switch } from '@/components/ui/switch';
+import { useTranslate } from '@/hooks/common-hooks';
+import { cn } from '@/lib/utils';
+import { ArrowUpRight } from 'lucide-react';
+import { useFormContext } from 'react-hook-form';
+import {
+ useHasParsedDocument,
+ useSelectChunkMethodList,
+ useSelectEmbeddingModelOptions,
+} from '../hooks';
+
+export function ChunkMethodItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+ // const handleChunkMethodSelectChange = useHandleChunkMethodSelectChange(form);
+ const parserList = useSelectChunkMethodList();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'parser_id'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="flex items-center">
+ <FormLabel
+ required
+ tooltip={t('chunkMethodTip')}
+ className="text-sm text-muted-foreground whitespace-wrap w-1/4"
+ >
+ {t('chunkMethod')}
+ </FormLabel>
+ <div className="w-3/4 ">
+ <FormControl>
+ <RAGFlowSelect
+ {...field}
+ options={parserList}
+ placeholder={t('chunkMethodPlaceholder')}
+ // onChange={handleChunkMethodSelectChange}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
+
+export function EmbeddingModelItem({ line = 1 }: { line?: 1 | 2 }) {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+ const embeddingModelOptions = useSelectEmbeddingModelOptions();
+ const disabled = useHasParsedDocument();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'embd_id'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className={cn({ 'flex items-center': line === 1 })}>
+ <FormLabel
+ required
+ tooltip={t('embeddingModelTip')}
+ className={cn('text-sm whitespace-wrap ', {
+ 'w-1/4': line === 1,
+ })}
+ >
+ {t('embeddingModel')}
+ </FormLabel>
+ <div
+ className={cn('text-muted-foreground', { 'w-3/4': line === 1 })}
+ >
+ <FormControl>
+ <RAGFlowSelect
+ {...field}
+ options={embeddingModelOptions}
+ disabled={disabled}
+ placeholder={t('embeddingModelPlaceholder')}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
+
+export function ParseTypeItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'parseType'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <FormLabel
+ tooltip={t('parseTypeTip')}
+ className="text-sm whitespace-wrap "
+ >
+ {t('parseType')}
+ </FormLabel>
+ <div className="text-muted-foreground">
+ <FormControl>
+ <Radio.Group {...field}>
+ <div className="w-3/4 flex gap-2 justify-between text-muted-foreground">
+ <Radio value={1}>{t('builtIn')}</Radio>
+ <Radio value={2}>{t('manualSetup')}</Radio>
+ </div>
+ </Radio.Group>
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
+
+export function DataFlowItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'data_flow'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <div className="flex gap-2 justify-between ">
+ <FormLabel
+ tooltip={t('dataFlowTip')}
+ className="text-sm text-text-primary whitespace-wrap "
+ >
+ {t('dataFlow')}
+ </FormLabel>
+ <div className="text-sm flex text-text-primary">
+ {t('buildItFromScratch')}
+ <ArrowUpRight size={14} />
+ </div>
+ </div>
+
+ <div className="text-muted-foreground">
+ <FormControl>
+ <RAGFlowSelect
+ {...field}
+ placeholder={t('dataFlowPlaceholder')}
+ options={[{ value: '0', label: t('dataFlowDefault') }]}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
+
+export function DataExtractKnowledgeItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <>
+ {' '}
+ <FormField
+ control={form.control}
+ name={'extractKnowledgeGraph'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <FormLabel
+ tooltip={t('extractKnowledgeGraphTip')}
+ className="text-sm whitespace-wrap "
+ >
+ {t('extractKnowledgeGraph')}
+ </FormLabel>
+ <div className="text-muted-foreground">
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />{' '}
+ <FormField
+ control={form.control}
+ name={'useRAPTORToEnhanceRetrieval'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <FormLabel
+ tooltip={t('useRAPTORToEnhanceRetrievalTip')}
+ className="text-sm whitespace-wrap "
+ >
+ {t('useRAPTORToEnhanceRetrieval')}
+ </FormLabel>
+ <div className="text-muted-foreground">
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ </>
+ );
+}
+
+export function TeamItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'team'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <FormLabel
+ tooltip={t('teamTip')}
+ className="text-sm whitespace-wrap "
+ >
+ <span className="text-destructive mr-1"> *</span>
+ {t('team')}
+ </FormLabel>
+ <div className="text-muted-foreground">
+ <FormControl>
+ <RAGFlowSelect
+ {...field}
+ placeholder={t('teamPlaceholder')}
+ options={[{ value: '0', label: t('teamDefault') }]}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
+
+export function EnableAutoGenerateItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'enableAutoGenerate'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="flex items-center">
+ <FormLabel
+ tooltip={t('enableAutoGenerateTip')}
+ className="text-sm whitespace-wrap w-1/4"
+ >
+ {t('enableAutoGenerate')}
+ </FormLabel>
+ <div className="text-muted-foreground w-3/4">
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
diff --git a/web/src/pages/dataset/dataset-setting/form-schema.ts b/web/src/pages/dataset/dataset-setting/form-schema.ts
new file mode 100644
index 0000000000..1594ba3626
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/form-schema.ts
@@ -0,0 +1,73 @@
+import { z } from 'zod';
+
+export const formSchema = z.object({
+ name: z.string().min(1, {
+ message: 'Username must be at least 2 characters.',
+ }),
+ description: z.string().min(2, {
+ message: 'Username must be at least 2 characters.',
+ }),
+ // avatar: z.instanceof(File),
+ avatar: z.any().nullish(),
+ permission: z.string().optional(),
+ parser_id: z.string(),
+ embd_id: z.string(),
+ parser_config: z
+ .object({
+ layout_recognize: z.string(),
+ chunk_token_num: z.number(),
+ delimiter: z.string(),
+ auto_keywords: z.number().optional(),
+ auto_questions: z.number().optional(),
+ html4excel: z.boolean(),
+ tag_kb_ids: z.array(z.string()).nullish(),
+ topn_tags: z.number().optional(),
+ raptor: z
+ .object({
+ use_raptor: z.boolean().optional(),
+ prompt: z.string().optional(),
+ max_token: z.number().optional(),
+ threshold: z.number().optional(),
+ max_cluster: z.number().optional(),
+ random_seed: z.number().optional(),
+ })
+ .refine(
+ (data) => {
+ if (data.use_raptor && !data.prompt) {
+ return false;
+ }
+ return true;
+ },
+ {
+ message: 'Prompt is required',
+ path: ['prompt'],
+ },
+ ),
+ graphrag: z
+ .object({
+ use_graphrag: z.boolean().optional(),
+ entity_types: z.array(z.string()).optional(),
+ method: z.string().optional(),
+ resolution: z.boolean().optional(),
+ community: z.boolean().optional(),
+ })
+ .refine(
+ (data) => {
+ if (
+ data.use_graphrag &&
+ (!data.entity_types || data.entity_types.length === 0)
+ ) {
+ return false;
+ }
+ return true;
+ },
+ {
+ message: 'Please enter Entity types',
+ path: ['entity_types'],
+ },
+ ),
+ })
+ .optional(),
+ pagerank: z.number(),
+ // icon: z.array(z.instanceof(File)),
+});
diff --git a/web/src/pages/dataset/dataset-setting/general-form.tsx b/web/src/pages/dataset/dataset-setting/general-form.tsx
new file mode 100644
index 0000000000..f7dc59e8bd
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/general-form.tsx
@@ -0,0 +1,92 @@
+import { AvatarUpload } from '@/components/avatar-upload';
+import {
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from '@/components/ui/form';
+import { Input } from '@/components/ui/input';
+import { useFormContext } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+import { EmbeddingModelItem } from './configuration/common-item';
+import { PermissionFormField } from './permission-form-field';
+
+export function GeneralForm() {
+ const form = useFormContext();
+ const { t } = useTranslation();
+
+ return (
+ <section className="space-y-4">
+ <FormField
+ control={form.control}
+ name="name"
+ render={({ field }) => (
+ <FormItem className="items-center space-y-0">
+ <div className="flex">
+ <FormLabel className="text-sm text-muted-foreground whitespace-nowrap w-1/4">
+ <span className="text-red-600">*</span>
+ {t('common.name')}
+ </FormLabel>
+ <FormControl className="w-3/4">
+ <Input {...field}></Input>
+ </FormControl>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="avatar"
+ render={({ field }) => (
+ <FormItem className="items-center space-y-0">
+ <div className="flex">
+ <FormLabel className="text-sm text-muted-foreground whitespace-nowrap w-1/4">
+ {t('setting.avatar')}
+ </FormLabel>
+ <FormControl className="w-3/4">
+ <AvatarUpload {...field}></AvatarUpload>
+ </FormControl>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => {
+ // null initialize empty string
+ if (typeof field.value === 'object' && !field.value) {
+ form.setValue('description', ' ');
+ }
+ return (
+ <FormItem className="items-center space-y-0">
+ <div className="flex">
+ <FormLabel className="text-sm text-muted-foreground whitespace-nowrap w-1/4">
+ {t('flow.description')}
+ </FormLabel>
+ <FormControl className="w-3/4">
+ <Input {...field}></Input>
+ </FormControl>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ );
+ }}
+ />
+ <PermissionFormField></PermissionFormField>
+ <EmbeddingModelItem></EmbeddingModelItem>
+ </section>
+ );
+}
diff --git a/web/src/pages/dataset/dataset-setting/hooks.ts b/web/src/pages/dataset/dataset-setting/hooks.ts
new file mode 100644
index 0000000000..3332ca3f57
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/hooks.ts
@@ -0,0 +1,87 @@
+import { LlmModelType } from '@/constants/knowledge';
+import { useSetModalState } from '@/hooks/common-hooks';
+
+import { useSelectLlmOptionsByModelType } from '@/hooks/llm-hooks';
+import { useFetchKnowledgeBaseConfiguration } from '@/hooks/use-knowledge-request';
+import { useSelectParserList } from '@/hooks/user-setting-hooks';
+import { useIsFetching } from '@tanstack/react-query';
+import { pick } from 'lodash';
+import { useCallback, useEffect, useState } from 'react';
+import { UseFormReturn } from 'react-hook-form';
+import { z } from 'zod';
+import { formSchema } from './form-schema';
+
+// The value that does not need to be displayed in the analysis method Select
+const HiddenFields = ['email', 'picture', 'audio'];
+
+export function useSelectChunkMethodList() {
+ const parserList = useSelectParserList();
+
+ return parserList.filter((x) => !HiddenFields.some((y) => y === x.value));
+}
+
+export function useSelectEmbeddingModelOptions() {
+ const allOptions = useSelectLlmOptionsByModelType();
+ return allOptions[LlmModelType.Embedding];
+}
+
+export function useHasParsedDocument() {
+ const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
+ return knowledgeDetails.chunk_num > 0;
+}
+
+export const useFetchKnowledgeConfigurationOnMount = (
+ form: UseFormReturn<z.infer<typeof formSchema>, any, undefined>,
+) => {
+ const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
+
+ useEffect(() => {
+ const parser_config = {
+ ...form.formState?.defaultValues?.parser_config,
+ ...knowledgeDetails.parser_config,
+ };
+ const formValues = {
+ ...pick({ ...knowledgeDetails, parser_config: parser_config }, [
+ 'description',
+ 'name',
+ 'permission',
+ 'embd_id',
+ 'parser_id',
+ 'language',
+ 'parser_config',
+ 'pagerank',
+ 'avatar',
+ ]),
+ };
+ form.reset(formValues);
+ }, [form, knowledgeDetails]);
+
+ return knowledgeDetails;
+};
+
+export const useSelectKnowledgeDetailsLoading = () =>
+ useIsFetching({ queryKey: ['fetchKnowledgeDetail'] }) > 0;
+
+export const useRenameKnowledgeTag = () => {
+ const [tag, setTag] = useState<string>('');
+ const {
+ visible: tagRenameVisible,
+ hideModal: hideTagRenameModal,
+ showModal: showFileRenameModal,
+ } = useSetModalState();
+
+ const handleShowTagRenameModal = useCallback(
+ (record: string) => {
+ setTag(record);
+ showFileRenameModal();
+ },
+ [showFileRenameModal],
+ );
+
+ return {
+ initialName: tag,
+ tagRenameVisible,
+ hideTagRenameModal,
+ showTagRenameModal: handleShowTagRenameModal,
+ };
+};
diff --git a/web/src/pages/dataset/dataset-setting/index.tsx b/web/src/pages/dataset/dataset-setting/index.tsx
new file mode 100644
index 0000000000..6c57f40e99
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/index.tsx
@@ -0,0 +1,88 @@
+import { Form } from '@/components/ui/form';
+import { DocumentParserType } from '@/constants/knowledge';
+import { PermissionRole } from '@/constants/permission';
+import { zodResolver } from '@hookform/resolvers/zod';
+import { useForm } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+import { z } from 'zod';
+import { TopTitle } from '../dataset-title';
+import { ChunkMethodForm } from './chunk-method-form';
+import { formSchema } from './form-schema';
+import { GeneralForm } from './general-form';
+import { useFetchKnowledgeConfigurationOnMount } from './hooks';
+
+const enum DocumentType {
+ DeepDOC = 'DeepDOC',
+ PlainText = 'Plain Text',
+}
+
+const initialEntityTypes = [
+ 'organization',
+ 'person',
+ 'geo',
+ 'event',
+ 'category',
+];
+
+const enum MethodValue {
+ General = 'general',
+ Light = 'light',
+}
+
+export default function DatasetSettings() {
+ const { t } = useTranslation();
+ const form = useForm<z.infer<typeof formSchema>>({
+ resolver: zodResolver(formSchema),
+ defaultValues: {
+ name: '',
+ parser_id: DocumentParserType.Naive,
+ permission: PermissionRole.Me,
+ parser_config: {
+ layout_recognize: DocumentType.DeepDOC,
+ chunk_token_num: 512,
+ delimiter: `\n`,
+ auto_keywords: 0,
+ auto_questions: 0,
+ html4excel: false,
+ topn_tags: 3,
+ raptor: {
+ use_raptor: false,
+ },
+ graphrag: {
+ use_graphrag: false,
+ entity_types: initialEntityTypes,
+ method: MethodValue.Light,
+ },
+ },
+ pagerank: 0,
+ },
+ });
+
+ useFetchKnowledgeConfigurationOnMount(form);
+
+ async function onSubmit(data: z.infer<typeof formSchema>) {
+ console.log('🚀 ~ DatasetSettings ~ data:', data);
+ }
+
+ return (
+ <section className="p-5 h-full flex flex-col">
+ <TopTitle
+ title={t('knowledgeDetails.configuration')}
+ description={t('knowledgeConfiguration.titleDescription')}
+ ></TopTitle>
+ <div className="flex gap-14 flex-1 min-h-0">
+ <Form {...form}>
+ <form
+ onSubmit={form.handleSubmit(onSubmit)}
+ className="space-y-6 flex-1"
+ >
+ <div className="w-[768px]">
+ <GeneralForm></GeneralForm>
+ <ChunkMethodForm></ChunkMethodForm>
+ </div>
+ </form>
+ </Form>
+ </div>
+ </section>
+ );
+}
diff --git a/web/src/pages/dataset/dataset-setting/naive.tsx b/web/src/pages/dataset/dataset-setting/naive.tsx
new file mode 100644
index 0000000000..0c4c538bbe
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/naive.tsx
@@ -0,0 +1,33 @@
+import GraphRagItems from '@/components/parse-configuration/graph-rag-form-fields';
+import RaptorFormFields from '@/components/parse-configuration/raptor-form-fields';
+import {
+ ConfigurationFormContainer,
+ MainContainer,
+} from './configuration-form-container';
+import { EnableAutoGenerateItem } from './configuration/common-item';
+
+export function NaiveConfiguration() {
+ return (
+ <MainContainer>
+ <GraphRagItems className="border-none p-0"></GraphRagItems>
+ <ConfigurationFormContainer>
+ <RaptorFormFields></RaptorFormFields>
+ </ConfigurationFormContainer>
+ <EnableAutoGenerateItem />
+ {/* <ConfigurationFormContainer>
+ <ChunkMethodItem></ChunkMethodItem>
+ <LayoutRecognizeFormField></LayoutRecognizeFormField>
+
+ <MaxTokenNumberFormField initialValue={512}></MaxTokenNumberFormField>
+ <DelimiterFormField></DelimiterFormField>
+ </ConfigurationFormContainer>
+ <ConfigurationFormContainer>
+ <PageRankFormField></PageRankFormField>
+ <AutoKeywordsFormField></AutoKeywordsFormField>
+ <AutoQuestionsFormField></AutoQuestionsFormField>
+ <ExcelToHtmlFormField></ExcelToHtmlFormField>
+ <TagItems></TagItems>
+ </ConfigurationFormContainer> */}
+ </MainContainer>
+ );
+}
diff --git a/web/src/pages/dataset/dataset-setting/permission-form-field.tsx b/web/src/pages/dataset/dataset-setting/permission-form-field.tsx
new file mode 100644
index 0000000000..ac095a79c4
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/permission-form-field.tsx
@@ -0,0 +1,29 @@
+import { SelectWithSearch } from '@/components/originui/select-with-search';
+import { RAGFlowFormItem } from '@/components/ragflow-form';
+import { PermissionRole } from '@/constants/permission';
+import { useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+export function PermissionFormField() {
+ const { t } = useTranslation();
+ const teamOptions = useMemo(() => {
+ return Object.values(PermissionRole).map((x) => ({
+ label: t('knowledgeConfiguration.' + x),
+ value: x,
+ }));
+ }, [t]);
+
+ return (
+ <RAGFlowFormItem
+ name="permission"
+ label={t('knowledgeConfiguration.permissions')}
+ tooltip={t('knowledgeConfiguration.permissionsTip')}
+ horizontal
+ >
+ <SelectWithSearch
+ options={teamOptions}
+ triggerClassName="w-3/4"
+ ></SelectWithSearch>
+ </RAGFlowFormItem>
+ );
+}
diff --git a/web/src/pages/dataset/dataset-setting/saving-button.tsx b/web/src/pages/dataset/dataset-setting/saving-button.tsx
new file mode 100644
index 0000000000..1fac81ea7e
--- /dev/null
+++ b/web/src/pages/dataset/dataset-setting/saving-button.tsx
@@ -0,0 +1,82 @@
+import { ButtonLoading } from '@/components/ui/button';
+import { useUpdateKnowledge } from '@/hooks/use-knowledge-request';
+import { useMemo } from 'react';
+import { useFormContext } from 'react-hook-form';
+import { useTranslation } from 'react-i18next';
+import { useParams } from 'umi';
+
+export function GeneralSavingButton() {
+ const form = useFormContext();
+ const { saveKnowledgeConfiguration, loading: submitLoading } =
+ useUpdateKnowledge();
+ const { id: kb_id } = useParams();
+ const { t } = useTranslation();
+
+ const defaultValues = useMemo(
+ () => form.formState.defaultValues ?? {},
+ [form.formState.defaultValues],
+ );
+ const parser_id = defaultValues['parser_id'];
+
+ return (
+ <ButtonLoading
+ type="button"
+ loading={submitLoading}
+ onClick={() => {
+ (async () => {
+ let isValidate = await form.trigger('name');
+ const { name, description, permission, avatar } = form.getValues();
+
+ if (isValidate) {
+ saveKnowledgeConfiguration({
+ kb_id,
+ parser_id,
+ name,
+ description,
+ avatar,
+ permission,
+ });
+ }
+ })();
+ }}
+ >
+ {t('knowledgeConfiguration.save')}
+ </ButtonLoading>
+ );
+}
+
+export function SavingButton() {
+ const { saveKnowledgeConfiguration, loading: submitLoading } =
+ useUpdateKnowledge();
+ const form = useFormContext();
+ const { id: kb_id } = useParams();
+ const { t } = useTranslation();
+
+ return (
+ <ButtonLoading
+ loading={submitLoading}
+ onClick={() => {
+ (async () => {
+ try {
+ let beValid = await form.formControl.trigger();
+ if (beValid) {
+ form.handleSubmit(async (values) => {
+ console.log('saveKnowledgeConfiguration: ', values);
+ delete values['avatar'];
+ await saveKnowledgeConfiguration({
+ kb_id,
+ ...values,
+ });
+ })();
+ }
+ } catch (e) {
+ console.log(e);
+ } finally {
+ }
+ })();
+ }}
+ >
+ {t('knowledgeConfiguration.save')}
+ </ButtonLoading>
+ );
+}
diff --git a/web/src/pages/dataset/dataset/generate.tsx b/web/src/pages/dataset/dataset/generate.tsx
new file mode 100644
index 0000000000..6dad4d56f5
--- /dev/null
+++ b/web/src/pages/dataset/dataset/generate.tsx
@@ -0,0 +1,68 @@
+import SvgIcon from '@/components/svg-icon';
+import { Button } from '@/components/ui/button';
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu';
+import { t } from 'i18next';
+import { lowerFirst, toLower } from 'lodash';
+import { WandSparkles } from 'lucide-react';
+
+const MenuItem: React.FC<{ name: 'KnowledgeGraph' | 'Raptor' }> = ({
+ name,
+}) => {
+ console.log(name, 'pppp');
+ return (
+ <div className="flex items-start gap-2 flex-col">
+ <div className="flex justify-start text-text-primary items-center gap-2">
+ <SvgIcon name={`data-flow/${toLower(name)}`} width={24}></SvgIcon>
+ {t(`knowledgeDetails.${lowerFirst(name)}`)}
+ </div>
+ <div className="text-text-secondary text-sm">
+ {t(`knowledgeDetails.generate${name}`)}
+ </div>
+ </div>
+ );
+};
+
+const Generate: React.FC = () => {
+ return (
+ <div className="generate">
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant={'transparent'}>
+ <WandSparkles className="mr-2" />
+ {t('knowledgeDetails.generate')}
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent className="w-[380px] p-2 ">
+ <DropdownMenuItem className="border cursor-pointer p-2 rounded-md hover:border-accent-primary hover:bg-[rgba(59,160,92,0.1)]">
+ <MenuItem name="KnowledgeGraph" />
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ className="border cursor-pointer p-2 rounded-md mt-3 hover:border-accent-primary hover:bg-[rgba(59,160,92,0.1)]"
+ onSelect={(e) => {
+ e.preventDefault();
+ }}
+ onClick={(e) => {
+ e.stopPropagation();
+ }}
+ >
+ <MenuItem name="Raptor" />
+ {/* <div className="flex items-start gap-2 flex-col">
+ <div className="flex items-center gap-2">
+ <SvgIcon name={`data-flow/raptor`} width={24}></SvgIcon>
+ {t('knowledgeDetails.raptor')}
+ </div>
+ <div>{t('knowledgeDetails.generateRaptor')}</div>
+ </div> */}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ );
+};
+
+export default Generate;
diff --git a/web/src/pages/dataset/dataset/index.tsx b/web/src/pages/dataset/dataset/index.tsx
index 41a523fb9b..f7752c5c32 100644
--- a/web/src/pages/dataset/dataset/index.tsx
+++ b/web/src/pages/dataset/dataset/index.tsx
@@ -15,6 +15,7 @@ import { useFetchDocumentList } from '@/hooks/use-document-request';
import { Upload } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { DatasetTable } from './dataset-table';
+import Generate from './generate';
import { useBulkOperateDataset } from './use-bulk-operate-dataset';
import { useCreateEmptyDocument } from './use-create-empty-document';
import { useSelectDatasetFilters } from './use-select-filters';
@@ -59,69 +60,74 @@ export default function Dataset() {
setRowSelection,
});
return (
- <section className="p-5 min-w-[880px]">
- <ListFilterBar
- title="Dataset"
- onSearchChange={handleInputChange}
- searchString={searchString}
- value={filterValue}
- onChange={handleFilterSubmit}
- onOpenChange={onOpenChange}
- filters={filters}
- leftPanel={
- <div className="items-start">
- <div className="pb-1">{t('knowledgeDetails.dataset')}</div>
- <div className="text-text-sub-title-invert text-sm">
- {t('knowledgeDetails.datasetDescription')}
+ <>
+ <div className="absolute top-4 right-5">
+ <Generate />
+ </div>
+ <section className="p-5 min-w-[880px]">
+ <ListFilterBar
+ title="Dataset"
+ onSearchChange={handleInputChange}
+ searchString={searchString}
+ value={filterValue}
+ onChange={handleFilterSubmit}
+ onOpenChange={onOpenChange}
+ filters={filters}
+ leftPanel={
+ <div className="items-start">
+ <div className="pb-1">{t('knowledgeDetails.dataset')}</div>
+ <div className="text-text-sub-title-invert text-sm">
+ {t('knowledgeDetails.datasetDescription')}
+ </div>
</div>
- </div>
- }
- >
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <Button size={'sm'}>
- <Upload />
- {t('knowledgeDetails.addFile')}
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent className="w-56">
- <DropdownMenuItem onClick={showDocumentUploadModal}>
- {t('fileManager.uploadFile')}
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem onClick={showCreateModal}>
- {t('knowledgeDetails.emptyFiles')}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </ListFilterBar>
- {rowSelectionIsEmpty || (
- <BulkOperateBar list={list} count={selectedCount}></BulkOperateBar>
- )}
- <DatasetTable
- documents={documents}
- pagination={pagination}
- setPagination={setPagination}
- rowSelection={rowSelection}
- setRowSelection={setRowSelection}
- loading={loading}
- ></DatasetTable>
- {documentUploadVisible && (
- <FileUploadDialog
- hideModal={hideDocumentUploadModal}
- onOk={onDocumentUploadOk}
- loading={documentUploadLoading}
- showParseOnCreation
- ></FileUploadDialog>
- )}
- {createVisible && (
- <RenameDialog
- hideModal={hideCreateModal}
- onOk={onCreateOk}
- loading={createLoading}
- title={'File Name'}
- ></RenameDialog>
- )}
- </section>
+ }
+ >
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button size={'sm'}>
+ <Upload />
+ {t('knowledgeDetails.addFile')}
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent className="w-56">
+ <DropdownMenuItem onClick={showDocumentUploadModal}>
+ {t('fileManager.uploadFile')}
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onClick={showCreateModal}>
+ {t('knowledgeDetails.emptyFiles')}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </ListFilterBar>
+ {rowSelectionIsEmpty || (
+ <BulkOperateBar list={list} count={selectedCount}></BulkOperateBar>
+ )}
+ <DatasetTable
+ documents={documents}
+ pagination={pagination}
+ setPagination={setPagination}
+ rowSelection={rowSelection}
+ setRowSelection={setRowSelection}
+ loading={loading}
+ ></DatasetTable>
+ {documentUploadVisible && (
+ <FileUploadDialog
+ hideModal={hideDocumentUploadModal}
+ onOk={onDocumentUploadOk}
+ loading={documentUploadLoading}
+ showParseOnCreation
+ ></FileUploadDialog>
+ )}
+ {createVisible && (
+ <RenameDialog
+ hideModal={hideCreateModal}
+ onOk={onCreateOk}
+ loading={createLoading}
+ title={'File Name'}
+ ></RenameDialog>
+ )}
+ </section>
+ </>
);
}
diff --git a/web/src/pages/dataset/setting/configuration/common-item.tsx b/web/src/pages/dataset/setting/configuration/common-item.tsx
index 5706b671f8..12496183d8 100644
--- a/web/src/pages/dataset/setting/configuration/common-item.tsx
+++ b/web/src/pages/dataset/setting/configuration/common-item.tsx
@@ -5,8 +5,11 @@ import {
FormLabel,
FormMessage,
} from '@/components/ui/form';
+import { Radio } from '@/components/ui/radio';
import { RAGFlowSelect } from '@/components/ui/select';
+import { Switch } from '@/components/ui/switch';
import { useTranslate } from '@/hooks/common-hooks';
+import { ArrowUpRight } from 'lucide-react';
import { useFormContext } from 'react-hook-form';
import {
useHasParsedDocument,
@@ -67,15 +70,16 @@ export function EmbeddingModelItem() {
name={'embd_id'}
render={({ field }) => (
<FormItem className=" items-center space-y-0 ">
- <div className="flex items-center">
+ <div className="">
<FormLabel
required
tooltip={t('embeddingModelTip')}
- className="text-sm text-muted-foreground whitespace-wrap w-1/4"
+ className="text-sm whitespace-wrap "
>
+ <span className="text-destructive mr-1"> *</span>
{t('embeddingModel')}
</FormLabel>
- <div className="w-3/4">
+ <div className="text-muted-foreground">
<FormControl>
<RAGFlowSelect
{...field}
@@ -95,3 +99,190 @@ export function EmbeddingModelItem() {
/>
);
}
+
+export function ParseTypeItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'parseType'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <FormLabel
+ tooltip={t('parseTypeTip')}
+ className="text-sm whitespace-wrap "
+ >
+ {t('parseType')}
+ </FormLabel>
+ <div className="text-muted-foreground">
+ <FormControl>
+ <Radio.Group {...field}>
+ <div className="w-3/4 flex gap-2 justify-between text-muted-foreground">
+ <Radio value={1}>{t('builtIn')}</Radio>
+ <Radio value={2}>{t('manualSetup')}</Radio>
+ </div>
+ </Radio.Group>
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
+
+export function DataFlowItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'data_flow'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <div className="flex gap-2 justify-between ">
+ <FormLabel
+ tooltip={t('dataFlowTip')}
+ className="text-sm text-text-primary whitespace-wrap "
+ >
+ {t('dataFlow')}
+ </FormLabel>
+ <div className="text-sm flex text-text-primary">
+ {t('buildItFromScratch')}
+ <ArrowUpRight size={14} />
+ </div>
+ </div>
+
+ <div className="text-muted-foreground">
+ <FormControl>
+ <RAGFlowSelect
+ {...field}
+ placeholder={t('dataFlowPlaceholder')}
+ options={[{ value: '0', label: t('dataFlowDefault') }]}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
+
+export function DataExtractKnowledgeItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <>
+ {' '}
+ <FormField
+ control={form.control}
+ name={'extractKnowledgeGraph'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <FormLabel
+ tooltip={t('extractKnowledgeGraphTip')}
+ className="text-sm whitespace-wrap "
+ >
+ {t('extractKnowledgeGraph')}
+ </FormLabel>
+ <div className="text-muted-foreground">
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />{' '}
+ <FormField
+ control={form.control}
+ name={'useRAPTORToEnhanceRetrieval'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <FormLabel
+ tooltip={t('useRAPTORToEnhanceRetrievalTip')}
+ className="text-sm whitespace-wrap "
+ >
+ {t('useRAPTORToEnhanceRetrieval')}
+ </FormLabel>
+ <div className="text-muted-foreground">
+ <FormControl>
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ </>
+ );
+}
+
+export function TeamItem() {
+ const { t } = useTranslate('knowledgeConfiguration');
+ const form = useFormContext();
+
+ return (
+ <FormField
+ control={form.control}
+ name={'team'}
+ render={({ field }) => (
+ <FormItem className=" items-center space-y-0 ">
+ <div className="">
+ <FormLabel
+ tooltip={t('teamTip')}
+ className="text-sm whitespace-wrap "
+ >
+ <span className="text-destructive mr-1"> *</span>
+ {t('team')}
+ </FormLabel>
+ <div className="text-muted-foreground">
+ <FormControl>
+ <RAGFlowSelect
+ {...field}
+ placeholder={t('teamPlaceholder')}
+ options={[{ value: '0', label: t('teamDefault') }]}
+ />
+ </FormControl>
+ </div>
+ </div>
+ <div className="flex pt-1">
+ <div className="w-1/4"></div>
+ <FormMessage />
+ </div>
+ </FormItem>
+ )}
+ />
+ );
+}
diff --git a/web/src/pages/dataset/sidebar/index.tsx b/web/src/pages/dataset/sidebar/index.tsx
index 45b2dd2fd8..bcc160e224 100644
--- a/web/src/pages/dataset/sidebar/index.tsx
+++ b/web/src/pages/dataset/sidebar/index.tsx
@@ -9,7 +9,13 @@ import { cn, formatBytes } from '@/lib/utils';
import { Routes } from '@/routes';
import { formatPureDate } from '@/utils/date';
import { isEmpty } from 'lodash';
-import { Banknote, Database, FileSearch2, GitGraph } from 'lucide-react';
+import {
+ Banknote,
+ Database,
+ DatabaseZap,
+ FileSearch2,
+ GitGraph,
+} from 'lucide-react';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useHandleMenuClick } from './hooks';
@@ -28,6 +34,11 @@ export function SideBar({ refreshCount }: PropType) {
const items = useMemo(() => {
const list = [
+ {
+ icon: DatabaseZap,
+ label: t(`knowledgeDetails.overview`),
+ key: Routes.DataSetOverview,
+ },
{
icon: Database,
label: t(`knowledgeDetails.dataset`),
diff --git a/web/src/pages/datasets/dataset-creating-dialog.tsx b/web/src/pages/datasets/dataset-creating-dialog.tsx
index 8e6dac7d11..5bf28758b6 100644
--- a/web/src/pages/datasets/dataset-creating-dialog.tsx
+++ b/web/src/pages/datasets/dataset-creating-dialog.tsx
@@ -17,9 +17,16 @@ import {
import { Input } from '@/components/ui/input';
import { IModalProps } from '@/interfaces/common';
import { zodResolver } from '@hookform/resolvers/zod';
-import { useForm } from 'react-hook-form';
+import { useForm, useWatch } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
import { z } from 'zod';
+import {
+ DataExtractKnowledgeItem,
+ DataFlowItem,
+ EmbeddingModelItem,
+ ParseTypeItem,
+ TeamItem,
+} from '../dataset/dataset-setting/configuration/common-item';
const FormId = 'dataset-creating-form';
@@ -33,19 +40,24 @@ export function InputForm({ onOk }: IModalProps<any>) {
message: t('knowledgeList.namePlaceholder'),
})
.trim(),
+ parseType: z.number().optional(),
});
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
defaultValues: {
name: '',
+ parseType: 1,
},
});
function onSubmit(data: z.infer<typeof FormSchema>) {
onOk?.(data.name);
}
-
+ const parseType = useWatch({
+ control: form.control,
+ name: 'parseType',
+ });
return (
<Form {...form}>
<form
@@ -58,7 +70,10 @@ export function InputForm({ onOk }: IModalProps<any>) {
name="name"
render={({ field }) => (
<FormItem>
- <FormLabel>{t('knowledgeList.name')}</FormLabel>
+ <FormLabel>
+ <span className="text-destructive mr-1"> *</span>
+ {t('knowledgeList.name')}
+ </FormLabel>
<FormControl>
<Input
placeholder={t('knowledgeList.namePlaceholder')}
@@ -69,6 +84,15 @@ export function InputForm({ onOk }: IModalProps<any>) {
</FormItem>
)}
/>
+ <EmbeddingModelItem line={2} />
+ <ParseTypeItem />
+ {parseType === 2 && (
+ <>
+ <DataFlowItem />
+ <DataExtractKnowledgeItem />
+ <TeamItem />
+ </>
+ )}
</form>
</Form>
);
diff --git a/web/src/pages/datasets/process-log-modal.tsx b/web/src/pages/datasets/process-log-modal.tsx
new file mode 100644
index 0000000000..3b2c74b189
--- /dev/null
+++ b/web/src/pages/datasets/process-log-modal.tsx
@@ -0,0 +1,116 @@
+import { Button } from '@/components/ui/button';
+import { Modal } from '@/components/ui/modal/modal';
+import { useTranslate } from '@/hooks/common-hooks';
+import React from 'react';
+
+interface ProcessLogModalProps {
+ visible: boolean;
+ onCancel: () => void;
+ taskInfo: {
+ taskId: string;
+ fileName: string;
+ fileSize: string;
+ source: string;
+ task: string;
+ state: 'Running' | 'Completed' | 'Failed' | 'Pending';
+ startTime: string;
+ endTime?: string;
+ duration?: string;
+ details: string;
+ };
+}
+
+const StatusTag: React.FC<{ state: string }> = ({ state }) => {
+ const getTagStyle = () => {
+ switch (state) {
+ case 'Running':
+ return 'bg-green-500 text-green-100';
+ case 'Completed':
+ return 'bg-blue-500 text-blue-100';
+ case 'Failed':
+ return 'bg-red-500 text-red-100';
+ case 'Pending':
+ return 'bg-yellow-500 text-yellow-100';
+ default:
+ return 'bg-gray-500 text-gray-100';
+ }
+ };
+
+ return (
+ <span
+ className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getTagStyle()}`}
+ >
+ <span className="w-1.5 h-1.5 rounded-full mr-1 bg-current"></span>
+ {state}
+ </span>
+ );
+};
+
+const InfoItem: React.FC<{
+ label: string;
+ value: string | React.ReactNode;
+ className?: string;
+}> = ({ label, value, className = '' }) => {
+ return (
+ <div className={`flex flex-col mb-4 ${className}`}>
+ <span className="text-text-secondary text-sm">{label}</span>
+ <span className="text-text-primary mt-1">{value}</span>
+ </div>
+ );
+};
+
+const ProcessLogModal: React.FC<ProcessLogModalProps> = ({
+ visible,
+ onCancel,
+ taskInfo,
+}) => {
+ const { t } = useTranslate('knowledgeDetails');
+ return (
+ <Modal
+ title={t('processLog')}
+ open={visible}
+ onCancel={onCancel}
+ footer={
+ <div className="flex justify-end">
+ <Button onClick={onCancel}>{t('close')}</Button>
+ </div>
+ }
+ className="process-log-modal"
+ >
+ <div className="p-6 rounded-lg">
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
+ {/* Left Column */}
+ <div className="space-y-4">
+ <InfoItem label="Task ID" value={taskInfo.taskId} />
+ <InfoItem label="File Name" value={taskInfo.fileName} />
+ <InfoItem label="File Size" value={taskInfo.fileSize} />
+ <InfoItem label="Source" value={taskInfo.source} />
+ <InfoItem label="Task" value={taskInfo.task} />
+ <InfoItem label="Details" value={taskInfo.details} />
+ </div>
+
+ {/* Right Column */}
+ <div className="space-y-4">
+ <div className="flex flex-col">
+ <span className="text-text-secondary text-sm">States</span>
+ <div className="mt-1">
+ <StatusTag state={taskInfo.state} />
+ </div>
+ </div>
+
+ <InfoItem label="Start Time" value={taskInfo.startTime} />
+
+ <InfoItem label="End Time" value={taskInfo.endTime || '-'} />
+
+ <InfoItem
+ label="Duration"
+ value={taskInfo.duration ? `${taskInfo.duration}s` : '-'}
+ />
+ </div>
+ </div>
+ </div>
+ </Modal>
+ );
+};
+
+export default ProcessLogModal;
diff --git a/web/src/pages/next-search/search-home.tsx b/web/src/pages/next-search/search-home.tsx
index 0fa7d157bd..467c5d6f78 100644
--- a/web/src/pages/next-search/search-home.tsx
+++ b/web/src/pages/next-search/search-home.tsx
@@ -1,4 +1,5 @@
import { Input } from '@/components/originui/input';
+import Spotlight from '@/components/spotlight';
import message from '@/components/ui/message';
import { IUserInfo } from '@/interfaces/database/user-setting';
import { cn } from '@/lib/utils';
@@ -6,7 +7,6 @@ import { Search } from 'lucide-react';
import { Dispatch, SetStateAction } from 'react';
import { useTranslation } from 'react-i18next';
import './index.less';
-import Spotlight from './spotlight';
export default function SearchPage({
isSearching,
diff --git a/web/src/routes.ts b/web/src/routes.ts
index 7a975a7a28..c82f54c70f 100644
--- a/web/src/routes.ts
+++ b/web/src/routes.ts
@@ -44,6 +44,9 @@ export enum Routes {
UserSetting = '/user-setting',
DataFlows = '/data-flows',
DataFlow = '/data-flow',
+ DataSetOverview = '/dataset-overview',
+ DataSetSetting = '/dataset-setting',
+ DataflowResult = '/dataflow-result',
}
const routes = [
@@ -273,8 +276,21 @@ const routes = [
path: `${Routes.DatasetBase}${Routes.KnowledgeGraph}/:id`,
component: `@/pages${Routes.DatasetBase}${Routes.KnowledgeGraph}`,
},
+ {
+ path: `${Routes.DatasetBase}${Routes.DataSetOverview}/:id`,
+ component: `@/pages${Routes.DatasetBase}${Routes.DataSetOverview}`,
+ },
+ {
+ path: `${Routes.DatasetBase}${Routes.DataSetSetting}/:id`,
+ component: `@/pages${Routes.DatasetBase}${Routes.DataSetSetting}`,
+ },
],
},
+ {
+ path: `${Routes.DataflowResult}/:id`,
+ layout: false,
+ component: `@/pages${Routes.DataflowResult}`,
+ },
{
path: `${Routes.ParsedResult}/chunks`,
layout: false,
diff --git a/web/src/utils/common-util.ts b/web/src/utils/common-util.ts
index 60e5d4c7d1..5e770eff08 100644
--- a/web/src/utils/common-util.ts
+++ b/web/src/utils/common-util.ts
@@ -141,3 +141,65 @@ export function formatFileSize(bytes: number, si = true, dp = 1) {
return nextBytes.toFixed(dp) + ' ' + units[u];
}
+
+// Get the actual color value of a CSS variable
+function getCSSVariableValue(variableName: string): string {
+ const computedStyle = getComputedStyle(document.documentElement);
+ const value = computedStyle.getPropertyValue(variableName).trim();
+ if (!value) {
+ throw new Error(`CSS variable ${variableName} is not defined`);
+ }
+ return value;
+}
+
+// Parse the color and convert to RGBA
+export function parseColorToRGBA(color: string): [number, number, number] {
+ // Handling CSS variables (e.g. var(--accent-primary))
+ let colorStr = color;
+ if (colorStr.startsWith('var(')) {
+ const varMatch = color.match(/var\(([^)]+)\)/);
+ if (!varMatch) {
+ console.error(`Invalid CSS variable: ${color}`);
+ return [0, 0, 0];
+ }
+ const varName = varMatch[1];
+ if (!varName) {
+ console.error(`Invalid CSS variable: ${colorStr}`);
+ return [0, 0, 0];
+ }
+ colorStr = getCSSVariableValue(varName);
+ }
+
+ // Handles hexadecimal colors (e.g. #FF5733)
+ if (colorStr.startsWith('#')) {
+ const cleanedHex = colorStr.replace(/^#/, '');
+ if (cleanedHex.length === 3) {
+ return [
+ parseInt(cleanedHex[0] + cleanedHex[0], 16),
+ parseInt(cleanedHex[1] + cleanedHex[1], 16),
+ parseInt(cleanedHex[2] + cleanedHex[2], 16),
+ ];
+ }
+ return [
+ parseInt(cleanedHex.slice(0, 2), 16),
+ parseInt(cleanedHex.slice(2, 4), 16),
+ parseInt(cleanedHex.slice(4, 6), 16),
+ ];
+ }
+
+ // Handling RGB colors (e.g., rgb(255, 87, 51))
+ if (colorStr.startsWith('rgb')) {
+ const rgbMatch = colorStr.match(/rgb$$(\d+),\s*(\d+),\s*(\d+)$$/);
+ if (rgbMatch) {
+ return [
+ parseInt(rgbMatch[1]),
+ parseInt(rgbMatch[2]),
+ parseInt(rgbMatch[3]),
+ ];
+ }
+ console.error(`Unsupported RGB format: ${colorStr}`);
+ return [0, 0, 0];
+ }
+ console.error(`Unsupported colorStr format: ${colorStr}`);
+ return [0, 0, 0];
+}