diff --git a/lightrag/api/routers/query_routes.py b/lightrag/api/routers/query_routes.py index 600e680e4c4d141f8aee3e6cf41c8acf087a0fd4..6fe86f799226cf6fede3d294cec304d85eb34131 100644 --- a/lightrag/api/routers/query_routes.py +++ b/lightrag/api/routers/query_routes.py @@ -78,6 +78,11 @@ class QueryRequest(BaseModel): description="Number of complete conversation turns (user-assistant pairs) to consider in the response context.", ) + user_prompt: Optional[str] = Field( + default=None, + description="User-provided prompt for the query. If provided, this will be used instead of the default value from prompt template.", + ) + @field_validator("query", mode="after") @classmethod def query_strip_after(cls, query: str) -> str: diff --git a/lightrag/api/webui/assets/_basePickBy-Dv6p6ahL.js b/lightrag/api/webui/assets/_basePickBy--_O36kXE.js similarity index 95% rename from lightrag/api/webui/assets/_basePickBy-Dv6p6ahL.js rename to lightrag/api/webui/assets/_basePickBy--_O36kXE.js index a9ca6bd3edb847f2bf2cdd1d862c04438ef52ef2..4dc1549b431c285afea7c867e78bc96324af1c31 100644 Binary files a/lightrag/api/webui/assets/_basePickBy-Dv6p6ahL.js and b/lightrag/api/webui/assets/_basePickBy--_O36kXE.js differ diff --git a/lightrag/api/webui/assets/_baseUniq-D7fwxRvj.js b/lightrag/api/webui/assets/_baseUniq-D81M49Y6.js similarity index 98% rename from lightrag/api/webui/assets/_baseUniq-D7fwxRvj.js rename to lightrag/api/webui/assets/_baseUniq-D81M49Y6.js index 29287393282c293381af01b3791b9e5defbf48c5..6c4aca2eb6b45af91920313923d1ecd48e91bcce 100644 Binary files a/lightrag/api/webui/assets/_baseUniq-D7fwxRvj.js and b/lightrag/api/webui/assets/_baseUniq-D81M49Y6.js differ diff --git a/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-Di0P3qFY.js b/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-Ba9Io2eo.js similarity index 99% rename from lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-Di0P3qFY.js rename to lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-Ba9Io2eo.js index ddbd9bfc3f66aececb4ce0c9af08876a72598c70..ac5dfa41484850795592ab1728fc1442c1c79e86 100644 Binary files a/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-Di0P3qFY.js and b/lightrag/api/webui/assets/architectureDiagram-IEHRJDOE-Ba9Io2eo.js differ diff --git a/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-CCZHFr5P.js b/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-Ca9NC-96.js similarity index 99% rename from lightrag/api/webui/assets/blockDiagram-JOT3LUYC-CCZHFr5P.js rename to lightrag/api/webui/assets/blockDiagram-JOT3LUYC-Ca9NC-96.js index cbf705bafe53ff295621544cbc0322a3e1777730..d06a74a7fea6f2444455bae24fd0a39eec131278 100644 Binary files a/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-CCZHFr5P.js and b/lightrag/api/webui/assets/blockDiagram-JOT3LUYC-Ca9NC-96.js differ diff --git a/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-DYwH7GIZ.js b/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-DhTcycAT.js similarity index 99% rename from lightrag/api/webui/assets/c4Diagram-VJAJSXHY-DYwH7GIZ.js rename to lightrag/api/webui/assets/c4Diagram-VJAJSXHY-DhTcycAT.js index 49bbea6850f1a901544565dd4547b4ce5eb44662..ee163c79df9484983c5b40ae87048c22723e570c 100644 Binary files a/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-DYwH7GIZ.js and b/lightrag/api/webui/assets/c4Diagram-VJAJSXHY-DhTcycAT.js differ diff --git a/lightrag/api/webui/assets/chunk-4BMEZGHF-WR_wp-oy.js b/lightrag/api/webui/assets/chunk-4BMEZGHF-M5QBFtoC.js similarity index 78% rename from lightrag/api/webui/assets/chunk-4BMEZGHF-WR_wp-oy.js rename to lightrag/api/webui/assets/chunk-4BMEZGHF-M5QBFtoC.js index cf2af3d5547599b055967aa99bb22660db0074ad..f8b61bd1dea4bd7aecada06dd3f461c6df5534be 100644 Binary files a/lightrag/api/webui/assets/chunk-4BMEZGHF-WR_wp-oy.js and b/lightrag/api/webui/assets/chunk-4BMEZGHF-M5QBFtoC.js differ diff --git a/lightrag/api/webui/assets/chunk-A2AXSNBT-dlp4DAcZ.js b/lightrag/api/webui/assets/chunk-A2AXSNBT-CTXPIZDs.js similarity index 99% rename from lightrag/api/webui/assets/chunk-A2AXSNBT-dlp4DAcZ.js rename to lightrag/api/webui/assets/chunk-A2AXSNBT-CTXPIZDs.js index 150c6c0697a9210afe58a5a07dcaa0136b66c36b..a1d267feb41d08336b92d311aaff3482205fef22 100644 Binary files a/lightrag/api/webui/assets/chunk-A2AXSNBT-dlp4DAcZ.js and b/lightrag/api/webui/assets/chunk-A2AXSNBT-CTXPIZDs.js differ diff --git a/lightrag/api/webui/assets/chunk-AEK57VVT-DwVcIy50.js b/lightrag/api/webui/assets/chunk-AEK57VVT-BRJnVklE.js similarity index 99% rename from lightrag/api/webui/assets/chunk-AEK57VVT-DwVcIy50.js rename to lightrag/api/webui/assets/chunk-AEK57VVT-BRJnVklE.js index a732dccf960a7745bacd95a41ac60487a384f6b9..eb171e683218df0a119e19790b64026603b64191 100644 Binary files a/lightrag/api/webui/assets/chunk-AEK57VVT-DwVcIy50.js and b/lightrag/api/webui/assets/chunk-AEK57VVT-BRJnVklE.js differ diff --git a/lightrag/api/webui/assets/chunk-D6G4REZN-StK6Rbr_.js b/lightrag/api/webui/assets/chunk-D6G4REZN-CO4Tk6j6.js similarity index 95% rename from lightrag/api/webui/assets/chunk-D6G4REZN-StK6Rbr_.js rename to lightrag/api/webui/assets/chunk-D6G4REZN-CO4Tk6j6.js index 91dbe86f09dba79cab982d691e26e0a3066d9b9c..7c44b9b0cc105e81f740e80afe40260f0dec5268 100644 Binary files a/lightrag/api/webui/assets/chunk-D6G4REZN-StK6Rbr_.js and b/lightrag/api/webui/assets/chunk-D6G4REZN-CO4Tk6j6.js differ diff --git a/lightrag/api/webui/assets/chunk-RZ5BOZE2-DacnBdPn.js b/lightrag/api/webui/assets/chunk-RZ5BOZE2-vCqEaZEa.js similarity index 81% rename from lightrag/api/webui/assets/chunk-RZ5BOZE2-DacnBdPn.js rename to lightrag/api/webui/assets/chunk-RZ5BOZE2-vCqEaZEa.js index 606c98f1f699c290c2f0f51759de62371c2cc76d..90a7eecec964041b562d06d16d382469d9bb74e8 100644 Binary files a/lightrag/api/webui/assets/chunk-RZ5BOZE2-DacnBdPn.js and b/lightrag/api/webui/assets/chunk-RZ5BOZE2-vCqEaZEa.js differ diff --git a/lightrag/api/webui/assets/chunk-XZIHB7SX-BLR4huZX.js b/lightrag/api/webui/assets/chunk-XZIHB7SX-BjHVUYBP.js similarity index 67% rename from lightrag/api/webui/assets/chunk-XZIHB7SX-BLR4huZX.js rename to lightrag/api/webui/assets/chunk-XZIHB7SX-BjHVUYBP.js index a992d8b295f7b6b9b1fff07b5f4437f0fdf8e684..e11dbf4b08f151e1d0bbee946d686ede8809e79b 100644 Binary files a/lightrag/api/webui/assets/chunk-XZIHB7SX-BLR4huZX.js and b/lightrag/api/webui/assets/chunk-XZIHB7SX-BjHVUYBP.js differ diff --git a/lightrag/api/webui/assets/classDiagram-GIVACNV2-DHdZrgr6.js b/lightrag/api/webui/assets/classDiagram-GIVACNV2-DUFHlr92.js similarity index 61% rename from lightrag/api/webui/assets/classDiagram-GIVACNV2-DHdZrgr6.js rename to lightrag/api/webui/assets/classDiagram-GIVACNV2-DUFHlr92.js index c51ad6c4af526fcd305accca47c557a6c2b91abc..1b46fb20a06ae11f7a68ac9e251481dc2f1e9d91 100644 Binary files a/lightrag/api/webui/assets/classDiagram-GIVACNV2-DHdZrgr6.js and b/lightrag/api/webui/assets/classDiagram-GIVACNV2-DUFHlr92.js differ diff --git a/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-DHdZrgr6.js b/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-DUFHlr92.js similarity index 61% rename from lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-DHdZrgr6.js rename to lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-DUFHlr92.js index c51ad6c4af526fcd305accca47c557a6c2b91abc..1b46fb20a06ae11f7a68ac9e251481dc2f1e9d91 100644 Binary files a/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-DHdZrgr6.js and b/lightrag/api/webui/assets/classDiagram-v2-COTLJTTW-DUFHlr92.js differ diff --git a/lightrag/api/webui/assets/clone-BHIBWXu-.js b/lightrag/api/webui/assets/clone-BHIBWXu-.js new file mode 100644 index 0000000000000000000000000000000000000000..079c5aafb15d9b0d15b49d594d4b71d76091e0f1 Binary files /dev/null and b/lightrag/api/webui/assets/clone-BHIBWXu-.js differ diff --git a/lightrag/api/webui/assets/clone-bPboWGu0.js b/lightrag/api/webui/assets/clone-bPboWGu0.js deleted file mode 100644 index 687fb1f9607f6e38ceeffd7f19df66d601cf5838..0000000000000000000000000000000000000000 Binary files a/lightrag/api/webui/assets/clone-bPboWGu0.js and /dev/null differ diff --git a/lightrag/api/webui/assets/dagre-OKDRZEBW-D3I5ukn6.js b/lightrag/api/webui/assets/dagre-OKDRZEBW-hl_RTy2g.js similarity index 97% rename from lightrag/api/webui/assets/dagre-OKDRZEBW-D3I5ukn6.js rename to lightrag/api/webui/assets/dagre-OKDRZEBW-hl_RTy2g.js index 2110146ad2af3f612a5abca83c6a853f38f84c62..0dc722566f3e68ef8ce4331db6101a4e9c2904cc 100644 Binary files a/lightrag/api/webui/assets/dagre-OKDRZEBW-D3I5ukn6.js and b/lightrag/api/webui/assets/dagre-OKDRZEBW-hl_RTy2g.js differ diff --git a/lightrag/api/webui/assets/diagram-SSKATNLV-BRpwtBhC.js b/lightrag/api/webui/assets/diagram-SSKATNLV-prPjpZ5y.js similarity index 93% rename from lightrag/api/webui/assets/diagram-SSKATNLV-BRpwtBhC.js rename to lightrag/api/webui/assets/diagram-SSKATNLV-prPjpZ5y.js index 6ad3de1147940bc984e101f17c3950d70261229e..6d0873d67aa17cccd551c32c21fb1bcc1e70ec65 100644 Binary files a/lightrag/api/webui/assets/diagram-SSKATNLV-BRpwtBhC.js and b/lightrag/api/webui/assets/diagram-SSKATNLV-prPjpZ5y.js differ diff --git a/lightrag/api/webui/assets/diagram-VNBRO52H-BUxc2-2Y.js b/lightrag/api/webui/assets/diagram-VNBRO52H-CpzL1-Is.js similarity index 90% rename from lightrag/api/webui/assets/diagram-VNBRO52H-BUxc2-2Y.js rename to lightrag/api/webui/assets/diagram-VNBRO52H-CpzL1-Is.js index e27881111b60f35f8bd81200f1ba43a5b1f96e7e..a1b5fafd7f65cf6faf6879696e9daae9f8d22ff6 100644 Binary files a/lightrag/api/webui/assets/diagram-VNBRO52H-BUxc2-2Y.js and b/lightrag/api/webui/assets/diagram-VNBRO52H-CpzL1-Is.js differ diff --git a/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-CVZJK2_D.js b/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-CAraTg_G.js similarity index 99% rename from lightrag/api/webui/assets/erDiagram-Q7BY3M3F-CVZJK2_D.js rename to lightrag/api/webui/assets/erDiagram-Q7BY3M3F-CAraTg_G.js index 9ff9aa0afa37279323d2a3673ccabaf8745b7daa..64e354e282911b51dd8eca004469dd66ad4822aa 100644 Binary files a/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-CVZJK2_D.js and b/lightrag/api/webui/assets/erDiagram-Q7BY3M3F-CAraTg_G.js differ diff --git a/lightrag/api/webui/assets/feature-documents-wtbEF8SC.js b/lightrag/api/webui/assets/feature-documents-BKQZIcI6.js similarity index 99% rename from lightrag/api/webui/assets/feature-documents-wtbEF8SC.js rename to lightrag/api/webui/assets/feature-documents-BKQZIcI6.js index 3c16b8489e761b3c6bc8e086c25cc38c3fa82694..7718b0adccb6176b78e3b5e9200a74e855fed2c7 100644 Binary files a/lightrag/api/webui/assets/feature-documents-wtbEF8SC.js and b/lightrag/api/webui/assets/feature-documents-BKQZIcI6.js differ diff --git a/lightrag/api/webui/assets/feature-graph-n9v7_77L.js b/lightrag/api/webui/assets/feature-graph-D6-O-kXP.js similarity index 97% rename from lightrag/api/webui/assets/feature-graph-n9v7_77L.js rename to lightrag/api/webui/assets/feature-graph-D6-O-kXP.js index 6c549250e88bf848d92056e9f17ae8d73b45403e..2d5f507bfe2a2fa6b8656e462588f974d7c7d08b 100644 Binary files a/lightrag/api/webui/assets/feature-graph-n9v7_77L.js and b/lightrag/api/webui/assets/feature-graph-D6-O-kXP.js differ diff --git a/lightrag/api/webui/assets/feature-retrieval-BWPImNx0.js b/lightrag/api/webui/assets/feature-retrieval-BWPImNx0.js deleted file mode 100644 index 615ae1f0da6d2b23510c6c23f814d8c35c5e1ed8..0000000000000000000000000000000000000000 Binary files a/lightrag/api/webui/assets/feature-retrieval-BWPImNx0.js and /dev/null differ diff --git a/lightrag/api/webui/assets/feature-retrieval-wTZcnY1B.js b/lightrag/api/webui/assets/feature-retrieval-wTZcnY1B.js new file mode 100644 index 0000000000000000000000000000000000000000..8662f27c558d0c70f3d2307674a4ad6a1dd09a96 Binary files /dev/null and b/lightrag/api/webui/assets/feature-retrieval-wTZcnY1B.js differ diff --git a/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-B06tP2Lf.js b/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-DC7cFb2q.js similarity index 99% rename from lightrag/api/webui/assets/flowDiagram-4HSFHLVR-B06tP2Lf.js rename to lightrag/api/webui/assets/flowDiagram-4HSFHLVR-DC7cFb2q.js index 0e3c118873f024d01ef0bbe983432c2ae2ed26fe..f49f66a7fee0b8f6feb510408bda9e57c89cddab 100644 Binary files a/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-B06tP2Lf.js and b/lightrag/api/webui/assets/flowDiagram-4HSFHLVR-DC7cFb2q.js differ diff --git a/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-CQRvmtrS.js b/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-CkKq4NOY.js similarity index 99% rename from lightrag/api/webui/assets/ganttDiagram-APWFNJXF-CQRvmtrS.js rename to lightrag/api/webui/assets/ganttDiagram-APWFNJXF-CkKq4NOY.js index e54f8a61a693f74ec4d96dbe7e0e4ee75155bcde..f063b4b28a23aa1a54c3063af68a6cc9d1f8f64e 100644 Binary files a/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-CQRvmtrS.js and b/lightrag/api/webui/assets/ganttDiagram-APWFNJXF-CkKq4NOY.js differ diff --git a/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-NQXP3Qqt.js b/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-C7t9VG9x.js similarity index 98% rename from lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-NQXP3Qqt.js rename to lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-C7t9VG9x.js index 81717e71dcc716e1b5e3233d9cb273d54a298e77..42276eb5fe2381f4c9a3a2df20a59ce76b5230f1 100644 Binary files a/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-NQXP3Qqt.js and b/lightrag/api/webui/assets/gitGraphDiagram-7IBYFJ6S-C7t9VG9x.js differ diff --git a/lightrag/api/webui/assets/graph-oZBbEMHh.js b/lightrag/api/webui/assets/graph-CmqUPRtj.js similarity index 97% rename from lightrag/api/webui/assets/graph-oZBbEMHh.js rename to lightrag/api/webui/assets/graph-CmqUPRtj.js index 760fde4ed243042909dba065f4a59bd063d6ae8f..9c6309d80e5ae816bd604c548b4279625ceacda1 100644 Binary files a/lightrag/api/webui/assets/graph-oZBbEMHh.js and b/lightrag/api/webui/assets/graph-CmqUPRtj.js differ diff --git a/lightrag/api/webui/assets/index-CvkPVz55.js b/lightrag/api/webui/assets/index-m6I92ZpT.js similarity index 84% rename from lightrag/api/webui/assets/index-CvkPVz55.js rename to lightrag/api/webui/assets/index-m6I92ZpT.js index cd1d555c3ac833518686c9a8f73d7ec7b893fe89..15bc8044c4d6696cb0d1adbdeafe67fe4815962e 100644 Binary files a/lightrag/api/webui/assets/index-CvkPVz55.js and b/lightrag/api/webui/assets/index-m6I92ZpT.js differ diff --git a/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-WiBZxbTM.js b/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-C4VRyMR4.js similarity index 61% rename from lightrag/api/webui/assets/infoDiagram-PH2N3AL5-WiBZxbTM.js rename to lightrag/api/webui/assets/infoDiagram-PH2N3AL5-C4VRyMR4.js index 2c33f6367a549a1271b51473ec871f0e601276d3..46481c80678fb899c380e7674737613a5390f508 100644 Binary files a/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-WiBZxbTM.js and b/lightrag/api/webui/assets/infoDiagram-PH2N3AL5-C4VRyMR4.js differ diff --git a/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-BXGb0-DG.js b/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-YPalBptu.js similarity index 99% rename from lightrag/api/webui/assets/journeyDiagram-U35MCT3I-BXGb0-DG.js rename to lightrag/api/webui/assets/journeyDiagram-U35MCT3I-YPalBptu.js index a42ea9cb003a601670c6af74a891cb8a898893d4..f5f5b8d3af0a271810929029f92ef50fb5d86373 100644 Binary files a/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-BXGb0-DG.js and b/lightrag/api/webui/assets/journeyDiagram-U35MCT3I-YPalBptu.js differ diff --git a/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-B5O_e_gP.js b/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-DDoftzBy.js similarity index 99% rename from lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-B5O_e_gP.js rename to lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-DDoftzBy.js index 1e9a41fcbef73e1474b667c39734c76d4c35afad..3e738f9b4afd1e4550812d3424e3a0db56d30694 100644 Binary files a/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-B5O_e_gP.js and b/lightrag/api/webui/assets/kanban-definition-NDS4AKOZ-DDoftzBy.js differ diff --git a/lightrag/api/webui/assets/layout-BojIpu1o.js b/lightrag/api/webui/assets/layout-Klo12PD4.js similarity index 99% rename from lightrag/api/webui/assets/layout-BojIpu1o.js rename to lightrag/api/webui/assets/layout-Klo12PD4.js index 6f99e45cd14b364c026408360bc6f2e463c122fd..0fbb88055f65cc3d045b484bb0cc5cbd775163f6 100644 Binary files a/lightrag/api/webui/assets/layout-BojIpu1o.js and b/lightrag/api/webui/assets/layout-Klo12PD4.js differ diff --git a/lightrag/api/webui/assets/mermaid-vendor-DJG80fdk.js b/lightrag/api/webui/assets/mermaid-vendor-SwnP6Sr8.js similarity index 99% rename from lightrag/api/webui/assets/mermaid-vendor-DJG80fdk.js rename to lightrag/api/webui/assets/mermaid-vendor-SwnP6Sr8.js index 8893a2e378329fd2dd96ce14ad9912284c15a2d6..6aab8f7e0b3574db8e223aa989fdf4d081d3faa2 100644 Binary files a/lightrag/api/webui/assets/mermaid-vendor-DJG80fdk.js and b/lightrag/api/webui/assets/mermaid-vendor-SwnP6Sr8.js differ diff --git a/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-TRtI_0iN.js b/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-DGAXVsL1.js similarity index 99% rename from lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-TRtI_0iN.js rename to lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-DGAXVsL1.js index 41c4d90d493fea2b4c71b276df61b68d20081092..fe28064786237858b09d2db3977320823157c64f 100644 Binary files a/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-TRtI_0iN.js and b/lightrag/api/webui/assets/mindmap-definition-ALO5MXBD-DGAXVsL1.js differ diff --git a/lightrag/api/webui/assets/pieDiagram-IB7DONF6-COfHI39o.js b/lightrag/api/webui/assets/pieDiagram-IB7DONF6-B0cIkycz.js similarity index 91% rename from lightrag/api/webui/assets/pieDiagram-IB7DONF6-COfHI39o.js rename to lightrag/api/webui/assets/pieDiagram-IB7DONF6-B0cIkycz.js index bc02f642423fc4911816815f4dff070bf62e39c9..d6bb2aa71387fbc08da6d118930fdbade40768cb 100644 Binary files a/lightrag/api/webui/assets/pieDiagram-IB7DONF6-COfHI39o.js and b/lightrag/api/webui/assets/pieDiagram-IB7DONF6-B0cIkycz.js differ diff --git a/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-BYCgdChU.js b/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-zmngfYyO.js similarity index 99% rename from lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-BYCgdChU.js rename to lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-zmngfYyO.js index 19a9f71a5c9928f94c71e11b1d16f9b9b66fa948..93caaa54d5b215fdaba10499a5b0edf000b2605e 100644 Binary files a/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-BYCgdChU.js and b/lightrag/api/webui/assets/quadrantDiagram-7GDLP6J5-zmngfYyO.js differ diff --git a/lightrag/api/webui/assets/radar-MK3ICKWK-BuDReZWo.js b/lightrag/api/webui/assets/radar-MK3ICKWK-CihkADAx.js similarity index 99% rename from lightrag/api/webui/assets/radar-MK3ICKWK-BuDReZWo.js rename to lightrag/api/webui/assets/radar-MK3ICKWK-CihkADAx.js index ffd649db1e4a8497cf929beed7ae843dd99680b4..b4d6721822b7bc9b2399cff5b2aea0ae1d15d7a1 100644 Binary files a/lightrag/api/webui/assets/radar-MK3ICKWK-BuDReZWo.js and b/lightrag/api/webui/assets/radar-MK3ICKWK-CihkADAx.js differ diff --git a/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-D3nMJW_g.js b/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-A4JwVpFF.js similarity index 99% rename from lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-D3nMJW_g.js rename to lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-A4JwVpFF.js index 10755018137b485fed2d5910c63923a233a4f878..606fa6a3e8b36e6cd5df43670e72c2ec9c11482d 100644 Binary files a/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-D3nMJW_g.js and b/lightrag/api/webui/assets/requirementDiagram-KVF5MWMF-A4JwVpFF.js differ diff --git a/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-B6O7zLhx.js b/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-DkTUSo82.js similarity index 99% rename from lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-B6O7zLhx.js rename to lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-DkTUSo82.js index 4559c77af885a47605736b8a2f34810a0cbb8257..86da3c2f64fac3e5529c572bbf47f584d5a2ed8b 100644 Binary files a/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-B6O7zLhx.js and b/lightrag/api/webui/assets/sankeyDiagram-QLVOVGJD-DkTUSo82.js differ diff --git a/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-BNKLY7TW.js b/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-hDfAwQVw.js similarity index 99% rename from lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-BNKLY7TW.js rename to lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-hDfAwQVw.js index b6db492c2f91a63cfbc030948d1b8d05cf426f77..d849a380b414d0d1979bfb730d2e7aaf68ef9e07 100644 Binary files a/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-BNKLY7TW.js and b/lightrag/api/webui/assets/sequenceDiagram-X6HHIX6F-hDfAwQVw.js differ diff --git a/lightrag/api/webui/assets/stateDiagram-DGXRK772-DVQpiu6y.js b/lightrag/api/webui/assets/stateDiagram-DGXRK772-CcL234E-.js similarity index 96% rename from lightrag/api/webui/assets/stateDiagram-DGXRK772-DVQpiu6y.js rename to lightrag/api/webui/assets/stateDiagram-DGXRK772-CcL234E-.js index 8590255bbbf3bbe2eae7fde9f96702ded4c28b3c..b93c17777b7c09a6a42c58758f6a6dedcec9ae0a 100644 Binary files a/lightrag/api/webui/assets/stateDiagram-DGXRK772-DVQpiu6y.js and b/lightrag/api/webui/assets/stateDiagram-DGXRK772-CcL234E-.js differ diff --git a/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-BHWn8Hav.js b/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-BnpIGSVY.js similarity index 61% rename from lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-BHWn8Hav.js rename to lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-BnpIGSVY.js index 34ddd9eea2121a68e9ccc388d3c69f6d31214385..32d1506bf461a373333ec1a5f5261d8082c2e338 100644 Binary files a/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-BHWn8Hav.js and b/lightrag/api/webui/assets/stateDiagram-v2-YXO3MK2T-BnpIGSVY.js differ diff --git a/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CAeS47FD.js b/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CFveliQS.js similarity index 99% rename from lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CAeS47FD.js rename to lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CFveliQS.js index cb0515ee57c5e5bb04a8c04cb880b16e7674c1ac..f08da36ee66b47781e7b8efbe5bf7bc25bcc137e 100644 Binary files a/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CAeS47FD.js and b/lightrag/api/webui/assets/timeline-definition-BDJGKUSR-CFveliQS.js differ diff --git a/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-DfkirVzk.js b/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-5OclOI0o.js similarity index 99% rename from lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-DfkirVzk.js rename to lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-5OclOI0o.js index 326b850dea120592181ca504a72c7df57079d483..29893bdb773b5f038a8ee18fbcbf1236caa0d871 100644 Binary files a/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-DfkirVzk.js and b/lightrag/api/webui/assets/xychartDiagram-VJFVF3MP-5OclOI0o.js differ diff --git a/lightrag/api/webui/index.html b/lightrag/api/webui/index.html index 81aba4f04d28f0624fbcd65b4516143b76b0c3f6..b4557561d62a19c0a47e30ce3f96564da5d5b531 100644 Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ diff --git a/lightrag/base.py b/lightrag/base.py index b1f63fa545a7bbce98a0b3b07c332cc6b3a01443..c6035f7051c5ba1c743bd978ee8f8a23fc146476 100644 --- a/lightrag/base.py +++ b/lightrag/base.py @@ -93,6 +93,11 @@ class QueryParam: This allows using different models for different query modes. """ + user_prompt: str | None = None + """User-provided prompt for the query. + If proivded, this will be use instead of the default vaulue from prompt template. + """ + @dataclass class StorageNameSpace(ABC): diff --git a/lightrag/operate.py b/lightrag/operate.py index 0ca3747c8cf7f04604c3622dc63c00c9e4446fff..3ffca35a0aa32f921b8e15a897784b55edfa1dba 100644 --- a/lightrag/operate.py +++ b/lightrag/operate.py @@ -925,11 +925,18 @@ async def kg_query( query_param.conversation_history, query_param.history_turns ) + # Build system prompt + user_prompt = ( + query_param.user_prompt + if query_param.user_prompt + else PROMPTS["DEFAULT_USER_PROMPT"] + ) sys_prompt_temp = system_prompt if system_prompt else PROMPTS["rag_response"] sys_prompt = sys_prompt_temp.format( context_data=context, response_type=query_param.response_type, history=history_context, + user_prompt=user_prompt, ) if query_param.only_need_prompt: @@ -1907,11 +1914,18 @@ async def naive_query( query_param.conversation_history, query_param.history_turns ) + # Build system prompt + user_prompt = ( + query_param.user_prompt + if query_param.user_prompt + else PROMPTS["DEFAULT_USER_PROMPT"] + ) sys_prompt_temp = system_prompt if system_prompt else PROMPTS["naive_rag_response"] sys_prompt = sys_prompt_temp.format( content_data=text_units_str, response_type=query_param.response_type, history=history_context, + user_prompt=user_prompt, ) if query_param.only_need_prompt: @@ -1957,6 +1971,7 @@ async def naive_query( return response +# TODO: Deprecated, use user_prompt in QueryParam instead async def kg_query_with_keywords( query: str, knowledge_graph_inst: BaseGraphStorage, @@ -2079,6 +2094,7 @@ async def kg_query_with_keywords( return response +# TODO: Deprecated, use user_prompt in QueryParam instead async def query_with_keywords( query: str, prompt: str, diff --git a/lightrag/prompt.py b/lightrag/prompt.py index 5616f66ae1e2321c94a297f05cac615b73f55d63..201d2c15c1056d2149429cb87670eef0026aaf5a 100644 --- a/lightrag/prompt.py +++ b/lightrag/prompt.py @@ -12,6 +12,8 @@ PROMPTS["DEFAULT_COMPLETION_DELIMITER"] = "<|COMPLETE|>" PROMPTS["DEFAULT_ENTITY_TYPES"] = ["organization", "person", "geo", "event", "category"] +PROMPTS["DEFAULT_USER_PROMPT"] = "n/a" + PROMPTS["entity_extraction"] = """---Goal--- Given a text document that is potentially relevant to this activity and a list of entity types, identify all entities of those types from the text and all relationships among the identified entities. Use {language} as output language. @@ -224,7 +226,10 @@ When handling relationships with timestamps: - Ensure the response maintains continuity with the conversation history. - List up to 5 most important reference sources at the end under "References" section. Clearly indicating whether each source is from Knowledge Graph (KG) or Vector Data (DC), and include the file path if available, in the following format: [KG/DC] file_path - If you don't know the answer, just say so. -- Do not make anything up. Do not include information not provided by the Knowledge Base.""" +- Do not make anything up. Do not include information not provided by the Knowledge Base. +- Addtional user prompt: {user_prompt} + +Response:""" PROMPTS["keywords_extraction"] = """---Role--- @@ -322,8 +327,10 @@ When handling content with timestamps: - Ensure the response maintains continuity with the conversation history. - List up to 5 most important reference sources at the end under "References" section. Clearly indicating each source from Document Chunks(DC), and include the file path if available, in the following format: [DC] file_path - If you don't know the answer, just say so. -- Do not include information not provided by the Document Chunks.""" +- Do not include information not provided by the Document Chunks. +- Addtional user prompt: {user_prompt} +Response:""" PROMPTS[ "similarity_check" diff --git a/lightrag_webui/src/api/lightrag.ts b/lightrag_webui/src/api/lightrag.ts index 5adeb8bef7fb881424735c6f2e14ab2b1c353390..55046e1578a485d1995bd5d392402ea1795b54b8 100644 --- a/lightrag_webui/src/api/lightrag.ts +++ b/lightrag_webui/src/api/lightrag.ts @@ -101,6 +101,8 @@ export type QueryRequest = { conversation_history?: Message[] /** Number of complete conversation turns (user-assistant pairs) to consider in the response context. */ history_turns?: number + /** User-provided prompt for the query. If provided, this will be used instead of the default value from prompt template. */ + user_prompt?: string } export type QueryResponse = { diff --git a/lightrag_webui/src/components/retrieval/QuerySettings.tsx b/lightrag_webui/src/components/retrieval/QuerySettings.tsx index 761d8e457046c153ccee0125711b504aca953d5f..735a4190271dca146325b9757ebff484aacca167 100644 --- a/lightrag_webui/src/components/retrieval/QuerySettings.tsx +++ b/lightrag_webui/src/components/retrieval/QuerySettings.tsx @@ -3,6 +3,7 @@ import { QueryMode, QueryRequest } from '@/api/lightrag' // Removed unused import for Text component import Checkbox from '@/components/ui/Checkbox' import NumberInput from '@/components/ui/NumberInput' +import Input from '@/components/ui/Input' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/Card' import { Select, @@ -28,7 +29,7 @@ export default function QuerySettings() { {t('retrievePanel.querySettings.parametersTitle')} - {t('retrievePanel.querySettings.parametersDescription')} + {t('retrievePanel.querySettings.parametersDescription')}
@@ -241,6 +242,31 @@ export default function QuerySettings() {
+ {/* User Prompt */} + <> + + + + + + +

{t('retrievePanel.querySettings.userPromptTooltip')}

+
+
+
+
+ handleChange('user_prompt', e.target.value)} + placeholder={t('retrievePanel.querySettings.userPromptPlaceholder')} + className="h-9" + /> +
+ + {/* Toggle Options */} <>
diff --git a/lightrag_webui/src/locales/ar.json b/lightrag_webui/src/locales/ar.json index 8b07f1bc707b103e6ace7a471068d356f76315bf..5cddc36a671007a891057401aa42b09a9dffb689 100644 --- a/lightrag_webui/src/locales/ar.json +++ b/lightrag_webui/src/locales/ar.json @@ -340,17 +340,15 @@ "historyTurns": "دورات التاريخ", "historyTurnsTooltip": "عدد الدورات الكاملة للمحادثة (أزواج المستخدم-المساعد) التي يجب مراعاتها في سياق الرد", "historyTurnsPlaceholder": "عدد دورات التاريخ", - "hlKeywords": "الكلمات المفتاحية عالية المستوى", - "hlKeywordsTooltip": "قائمة الكلمات المفتاحية عالية المستوى لإعطائها الأولوية في الاسترجاع. افصل بينها بفواصل", - "hlkeywordsPlaceHolder": "أدخل الكلمات المفتاحية", - "llKeywords": "الكلمات المفتاحية منخفضة المستوى", - "llKeywordsTooltip": "قائمة الكلمات المفتاحية منخفضة المستوى لتحسين تركيز الاسترجاع. افصل بينها بفواصل", "onlyNeedContext": "تحتاج فقط إلى السياق", "onlyNeedContextTooltip": "إذا كان صحيحًا، يتم إرجاع السياق المسترجع فقط دون إنشاء رد", "onlyNeedPrompt": "تحتاج فقط إلى المطالبة", "onlyNeedPromptTooltip": "إذا كان صحيحًا، يتم إرجاع المطالبة المولدة فقط دون إنتاج رد", "streamResponse": "تدفق الرد", - "streamResponseTooltip": "إذا كان صحيحًا، يتيح إخراج التدفق للردود في الوقت الفعلي" + "streamResponseTooltip": "إذا كان صحيحًا، يتيح إخراج التدفق للردود في الوقت الفعلي", + "userPrompt": "مطالبة مخصصة", + "userPromptTooltip": "تقديم متطلبات استجابة إضافية إلى نموذج اللغة الكبير (غير متعلقة بمحتوى الاستعلام، فقط لمعالجة المخرجات).", + "userPromptPlaceholder": "أدخل مطالبة مخصصة (اختياري)" } }, "apiSite": { diff --git a/lightrag_webui/src/locales/en.json b/lightrag_webui/src/locales/en.json index 80453d76736cd6c595534b73f20d34a2456814e8..bc29b990ea572988ed89ba5fe16121b96ef8f923 100644 --- a/lightrag_webui/src/locales/en.json +++ b/lightrag_webui/src/locales/en.json @@ -340,17 +340,15 @@ "historyTurns": "History Turns", "historyTurnsTooltip": "Number of complete conversation turns (user-assistant pairs) to consider in the response context", "historyTurnsPlaceholder": "Number of history turns", - "hlKeywords": "High-Level Keywords", - "hlKeywordsTooltip": "List of high-level keywords to prioritize in retrieval. Separate with commas", - "hlkeywordsPlaceHolder": "Enter keywords", - "llKeywords": "Low-Level Keywords", - "llKeywordsTooltip": "List of low-level keywords to refine retrieval focus. Separate with commas", "onlyNeedContext": "Only Need Context", "onlyNeedContextTooltip": "If True, only returns the retrieved context without generating a response", "onlyNeedPrompt": "Only Need Prompt", "onlyNeedPromptTooltip": "If True, only returns the generated prompt without producing a response", "streamResponse": "Stream Response", - "streamResponseTooltip": "If True, enables streaming output for real-time responses" + "streamResponseTooltip": "If True, enables streaming output for real-time responses", + "userPrompt": "User Prompt", + "userPromptTooltip": "Provide additional response requirements to the LLM (unrelated to query content, only for output processing).", + "userPromptPlaceholder": "Enter custom prompt (optional)" } }, "apiSite": { diff --git a/lightrag_webui/src/locales/fr.json b/lightrag_webui/src/locales/fr.json index 993c48a45cfd981b458efd6a38d20d533ada88be..0238e7ecd927bbd96b21e0ff31c96f842a7d2dee 100644 --- a/lightrag_webui/src/locales/fr.json +++ b/lightrag_webui/src/locales/fr.json @@ -340,17 +340,15 @@ "historyTurns": "Tours d'historique", "historyTurnsTooltip": "Nombre de tours complets de conversation (paires utilisateur-assistant) à prendre en compte dans le contexte de la réponse", "historyTurnsPlaceholder": "Nombre de tours d'historique", - "hlKeywords": "Mots-clés de haut niveau", - "hlKeywordsTooltip": "Liste de mots-clés de haut niveau à prioriser dans la récupération. Séparez par des virgules", - "hlkeywordsPlaceHolder": "Entrez les mots-clés", - "llKeywords": "Mots-clés de bas niveau", - "llKeywordsTooltip": "Liste de mots-clés de bas niveau pour affiner la focalisation de la récupération. Séparez par des virgules", "onlyNeedContext": "Besoin uniquement du contexte", "onlyNeedContextTooltip": "Si vrai, ne renvoie que le contexte récupéré sans générer de réponse", "onlyNeedPrompt": "Besoin uniquement de l'invite", "onlyNeedPromptTooltip": "Si vrai, ne renvoie que l'invite générée sans produire de réponse", "streamResponse": "Réponse en flux", - "streamResponseTooltip": "Si vrai, active la sortie en flux pour des réponses en temps réel" + "streamResponseTooltip": "Si vrai, active la sortie en flux pour des réponses en temps réel", + "userPrompt": "Invite personnalisée", + "userPromptTooltip": "Fournir des exigences de réponse supplémentaires au LLM (sans rapport avec le contenu de la requête, uniquement pour le traitement de sortie).", + "userPromptPlaceholder": "Entrez une invite personnalisée (facultatif)" } }, "apiSite": { diff --git a/lightrag_webui/src/locales/zh.json b/lightrag_webui/src/locales/zh.json index dc6213a67a1171aba052c87ecc5e091d0d5069e2..224965083a282c539fe957fd609de6721dd33cbb 100644 --- a/lightrag_webui/src/locales/zh.json +++ b/lightrag_webui/src/locales/zh.json @@ -340,17 +340,15 @@ "historyTurns": "历史轮次", "historyTurnsTooltip": "响应上下文中考虑的完整对话轮次(用户-助手对)数量", "historyTurnsPlaceholder": "历史轮次数", - "hlKeywords": "高级关键词", - "hlKeywordsTooltip": "检索中优先考虑的高级关键词列表。用逗号分隔", - "hlkeywordsPlaceHolder": "输入关键词", - "llKeywords": "低级关键词", - "llKeywordsTooltip": "用于细化检索重点的低级关键词列表。用逗号分隔", "onlyNeedContext": "仅需上下文", "onlyNeedContextTooltip": "如果为True,仅返回检索到的上下文而不生成响应", "onlyNeedPrompt": "仅需提示", "onlyNeedPromptTooltip": "如果为True,仅返回生成的提示而不产生响应", "streamResponse": "流式响应", - "streamResponseTooltip": "如果为True,启用实时流式输出响应" + "streamResponseTooltip": "如果为True,启用实时流式输出响应", + "userPrompt": "用户提示词", + "userPromptTooltip": "向LLM提供额外的响应要求(与查询内容无关,仅用于处理输出)。", + "userPromptPlaceholder": "输入自定义提示词(可选)" } }, "apiSite": { diff --git a/lightrag_webui/src/stores/settings.ts b/lightrag_webui/src/stores/settings.ts index 7de78f1585b1d430f4a8291fa0f4c8a51aa6db6d..fb3246ea3e3b6c1cf9cea6be5ae61f0cfeb13e25 100644 --- a/lightrag_webui/src/stores/settings.ts +++ b/lightrag_webui/src/stores/settings.ts @@ -115,7 +115,8 @@ const useSettingsStoreBase = create()( stream: true, history_turns: 3, hl_keywords: [], - ll_keywords: [] + ll_keywords: [], + user_prompt: '' }, setTheme: (theme: Theme) => set({ theme }), @@ -167,7 +168,7 @@ const useSettingsStoreBase = create()( { name: 'settings-storage', storage: createJSONStorage(() => localStorage), - version: 12, + version: 13, migrate: (state: any, version: number) => { if (version < 2) { state.showEdgeLabel = false @@ -225,6 +226,12 @@ const useSettingsStoreBase = create()( // Clear retrieval history to avoid compatibility issues with MessageWithError type state.retrievalHistory = [] } + if (version < 13) { + // Add user_prompt field for older versions + if (state.querySettings) { + state.querySettings.user_prompt = '' + } + } return state } }