You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

datasets_document.py 47KB

2 years ago
2 years ago
2 years ago
2 years ago
4 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
Introduce Plugins (#13836) Signed-off-by: yihong0618 <zouzou0208@gmail.com> Signed-off-by: -LAN- <laipz8200@outlook.com> Signed-off-by: xhe <xw897002528@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: takatost <takatost@gmail.com> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Novice Lee <novicelee@NoviPro.local> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com> Co-authored-by: AkaraChen <85140972+AkaraChen@users.noreply.github.com> Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: Novice <857526207@qq.com> Co-authored-by: Hiroki Nagai <82458324+nagaihiroki-git@users.noreply.github.com> Co-authored-by: Gen Sato <52241300+halogen22@users.noreply.github.com> Co-authored-by: eux <euxuuu@gmail.com> Co-authored-by: huangzhuo1949 <167434202+huangzhuo1949@users.noreply.github.com> Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com> Co-authored-by: lotsik <lotsik@mail.ru> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: gakkiyomi <gakkiyomi@aliyun.com> Co-authored-by: CN-P5 <heibai2006@gmail.com> Co-authored-by: CN-P5 <heibai2006@qq.com> Co-authored-by: Chuehnone <1897025+chuehnone@users.noreply.github.com> Co-authored-by: yihong <zouzou0208@gmail.com> Co-authored-by: Kevin9703 <51311316+Kevin9703@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Boris Feld <lothiraldan@gmail.com> Co-authored-by: mbo <himabo@gmail.com> Co-authored-by: mabo <mabo@aeyes.ai> Co-authored-by: Warren Chen <warren.chen830@gmail.com> Co-authored-by: JzoNgKVO <27049666+JzoNgKVO@users.noreply.github.com> Co-authored-by: jiandanfeng <chenjh3@wangsu.com> Co-authored-by: zhu-an <70234959+xhdd123321@users.noreply.github.com> Co-authored-by: zhaoqingyu.1075 <zhaoqingyu.1075@bytedance.com> Co-authored-by: 海狸大師 <86974027+yenslife@users.noreply.github.com> Co-authored-by: Xu Song <xusong.vip@gmail.com> Co-authored-by: rayshaw001 <396301947@163.com> Co-authored-by: Ding Jiatong <dingjiatong@gmail.com> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: JasonVV <jasonwangiii@outlook.com> Co-authored-by: le0zh <newlight@qq.com> Co-authored-by: zhuxinliang <zhuxinliang@didiglobal.com> Co-authored-by: k-zaku <zaku99@outlook.jp> Co-authored-by: luckylhb90 <luckylhb90@gmail.com> Co-authored-by: hobo.l <hobo.l@binance.com> Co-authored-by: jiangbo721 <365065261@qq.com> Co-authored-by: 刘江波 <jiangbo721@163.com> Co-authored-by: Shun Miyazawa <34241526+miya@users.noreply.github.com> Co-authored-by: EricPan <30651140+Egfly@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Jhvcc <37662342+Jhvcc@users.noreply.github.com> Co-authored-by: lowell <lowell.hu@zkteco.in> Co-authored-by: Boris Polonsky <BorisPolonsky@users.noreply.github.com> Co-authored-by: Ademílson Tonato <ademilsonft@outlook.com> Co-authored-by: Ademílson Tonato <ademilson.tonato@refurbed.com> Co-authored-by: IWAI, Masaharu <iwaim.sub@gmail.com> Co-authored-by: Yueh-Po Peng (Yabi) <94939112+y10ab1@users.noreply.github.com> Co-authored-by: Jason <ggbbddjm@gmail.com> Co-authored-by: Xin Zhang <sjhpzx@gmail.com> Co-authored-by: yjc980121 <3898524+yjc980121@users.noreply.github.com> Co-authored-by: heyszt <36215648+hieheihei@users.noreply.github.com> Co-authored-by: Abdullah AlOsaimi <osaimiacc@gmail.com> Co-authored-by: Abdullah AlOsaimi <189027247+osaimi@users.noreply.github.com> Co-authored-by: Yingchun Lai <laiyingchun@apache.org> Co-authored-by: Hash Brown <hi@xzd.me> Co-authored-by: zuodongxu <192560071+zuodongxu@users.noreply.github.com> Co-authored-by: Masashi Tomooka <tmokmss@users.noreply.github.com> Co-authored-by: aplio <ryo.091219@gmail.com> Co-authored-by: Obada Khalili <54270856+obadakhalili@users.noreply.github.com> Co-authored-by: Nam Vu <zuzoovn@gmail.com> Co-authored-by: Kei YAMAZAKI <1715090+kei-yamazaki@users.noreply.github.com> Co-authored-by: TechnoHouse <13776377+deephbz@users.noreply.github.com> Co-authored-by: Riddhimaan-Senapati <114703025+Riddhimaan-Senapati@users.noreply.github.com> Co-authored-by: MaFee921 <31881301+2284730142@users.noreply.github.com> Co-authored-by: te-chan <t-nakanome@sakura-is.co.jp> Co-authored-by: HQidea <HQidea@users.noreply.github.com> Co-authored-by: Joshbly <36315710+Joshbly@users.noreply.github.com> Co-authored-by: xhe <xw897002528@gmail.com> Co-authored-by: weiwenyan-dev <154779315+weiwenyan-dev@users.noreply.github.com> Co-authored-by: ex_wenyan.wei <ex_wenyan.wei@tcl.com> Co-authored-by: engchina <12236799+engchina@users.noreply.github.com> Co-authored-by: engchina <atjapan2015@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: Kemal <kemalmeler@outlook.com> Co-authored-by: Lazy_Frog <4590648+lazyFrogLOL@users.noreply.github.com> Co-authored-by: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Co-authored-by: Steven sun <98230804+Tuyohai@users.noreply.github.com> Co-authored-by: steven <sunzwj@digitalchina.com> Co-authored-by: Kalo Chin <91766386+fdb02983rhy@users.noreply.github.com> Co-authored-by: Katy Tao <34019945+KatyTao@users.noreply.github.com> Co-authored-by: depy <42985524+h4ckdepy@users.noreply.github.com> Co-authored-by: 胡春东 <gycm520@gmail.com> Co-authored-by: Junjie.M <118170653@qq.com> Co-authored-by: MuYu <mr.muzea@gmail.com> Co-authored-by: Naoki Takashima <39912547+takatea@users.noreply.github.com> Co-authored-by: Summer-Gu <37869445+gubinjie@users.noreply.github.com> Co-authored-by: Fei He <droxer.he@gmail.com> Co-authored-by: ybalbert001 <120714773+ybalbert001@users.noreply.github.com> Co-authored-by: Yuanbo Li <ybalbert@amazon.com> Co-authored-by: douxc <7553076+douxc@users.noreply.github.com> Co-authored-by: liuzhenghua <1090179900@qq.com> Co-authored-by: Wu Jiayang <62842862+Wu-Jiayang@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: kimjion <45935338+kimjion@users.noreply.github.com> Co-authored-by: AugNSo <song.tiankai@icloud.com> Co-authored-by: llinvokerl <38915183+llinvokerl@users.noreply.github.com> Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com> Co-authored-by: Vasu Negi <vasu-negi@users.noreply.github.com> Co-authored-by: Hundredwz <1808096180@qq.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
8 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
Introduce Plugins (#13836) Signed-off-by: yihong0618 <zouzou0208@gmail.com> Signed-off-by: -LAN- <laipz8200@outlook.com> Signed-off-by: xhe <xw897002528@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: takatost <takatost@gmail.com> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Novice Lee <novicelee@NoviPro.local> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com> Co-authored-by: AkaraChen <85140972+AkaraChen@users.noreply.github.com> Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: Novice <857526207@qq.com> Co-authored-by: Hiroki Nagai <82458324+nagaihiroki-git@users.noreply.github.com> Co-authored-by: Gen Sato <52241300+halogen22@users.noreply.github.com> Co-authored-by: eux <euxuuu@gmail.com> Co-authored-by: huangzhuo1949 <167434202+huangzhuo1949@users.noreply.github.com> Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com> Co-authored-by: lotsik <lotsik@mail.ru> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: gakkiyomi <gakkiyomi@aliyun.com> Co-authored-by: CN-P5 <heibai2006@gmail.com> Co-authored-by: CN-P5 <heibai2006@qq.com> Co-authored-by: Chuehnone <1897025+chuehnone@users.noreply.github.com> Co-authored-by: yihong <zouzou0208@gmail.com> Co-authored-by: Kevin9703 <51311316+Kevin9703@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Boris Feld <lothiraldan@gmail.com> Co-authored-by: mbo <himabo@gmail.com> Co-authored-by: mabo <mabo@aeyes.ai> Co-authored-by: Warren Chen <warren.chen830@gmail.com> Co-authored-by: JzoNgKVO <27049666+JzoNgKVO@users.noreply.github.com> Co-authored-by: jiandanfeng <chenjh3@wangsu.com> Co-authored-by: zhu-an <70234959+xhdd123321@users.noreply.github.com> Co-authored-by: zhaoqingyu.1075 <zhaoqingyu.1075@bytedance.com> Co-authored-by: 海狸大師 <86974027+yenslife@users.noreply.github.com> Co-authored-by: Xu Song <xusong.vip@gmail.com> Co-authored-by: rayshaw001 <396301947@163.com> Co-authored-by: Ding Jiatong <dingjiatong@gmail.com> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: JasonVV <jasonwangiii@outlook.com> Co-authored-by: le0zh <newlight@qq.com> Co-authored-by: zhuxinliang <zhuxinliang@didiglobal.com> Co-authored-by: k-zaku <zaku99@outlook.jp> Co-authored-by: luckylhb90 <luckylhb90@gmail.com> Co-authored-by: hobo.l <hobo.l@binance.com> Co-authored-by: jiangbo721 <365065261@qq.com> Co-authored-by: 刘江波 <jiangbo721@163.com> Co-authored-by: Shun Miyazawa <34241526+miya@users.noreply.github.com> Co-authored-by: EricPan <30651140+Egfly@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Jhvcc <37662342+Jhvcc@users.noreply.github.com> Co-authored-by: lowell <lowell.hu@zkteco.in> Co-authored-by: Boris Polonsky <BorisPolonsky@users.noreply.github.com> Co-authored-by: Ademílson Tonato <ademilsonft@outlook.com> Co-authored-by: Ademílson Tonato <ademilson.tonato@refurbed.com> Co-authored-by: IWAI, Masaharu <iwaim.sub@gmail.com> Co-authored-by: Yueh-Po Peng (Yabi) <94939112+y10ab1@users.noreply.github.com> Co-authored-by: Jason <ggbbddjm@gmail.com> Co-authored-by: Xin Zhang <sjhpzx@gmail.com> Co-authored-by: yjc980121 <3898524+yjc980121@users.noreply.github.com> Co-authored-by: heyszt <36215648+hieheihei@users.noreply.github.com> Co-authored-by: Abdullah AlOsaimi <osaimiacc@gmail.com> Co-authored-by: Abdullah AlOsaimi <189027247+osaimi@users.noreply.github.com> Co-authored-by: Yingchun Lai <laiyingchun@apache.org> Co-authored-by: Hash Brown <hi@xzd.me> Co-authored-by: zuodongxu <192560071+zuodongxu@users.noreply.github.com> Co-authored-by: Masashi Tomooka <tmokmss@users.noreply.github.com> Co-authored-by: aplio <ryo.091219@gmail.com> Co-authored-by: Obada Khalili <54270856+obadakhalili@users.noreply.github.com> Co-authored-by: Nam Vu <zuzoovn@gmail.com> Co-authored-by: Kei YAMAZAKI <1715090+kei-yamazaki@users.noreply.github.com> Co-authored-by: TechnoHouse <13776377+deephbz@users.noreply.github.com> Co-authored-by: Riddhimaan-Senapati <114703025+Riddhimaan-Senapati@users.noreply.github.com> Co-authored-by: MaFee921 <31881301+2284730142@users.noreply.github.com> Co-authored-by: te-chan <t-nakanome@sakura-is.co.jp> Co-authored-by: HQidea <HQidea@users.noreply.github.com> Co-authored-by: Joshbly <36315710+Joshbly@users.noreply.github.com> Co-authored-by: xhe <xw897002528@gmail.com> Co-authored-by: weiwenyan-dev <154779315+weiwenyan-dev@users.noreply.github.com> Co-authored-by: ex_wenyan.wei <ex_wenyan.wei@tcl.com> Co-authored-by: engchina <12236799+engchina@users.noreply.github.com> Co-authored-by: engchina <atjapan2015@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: Kemal <kemalmeler@outlook.com> Co-authored-by: Lazy_Frog <4590648+lazyFrogLOL@users.noreply.github.com> Co-authored-by: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Co-authored-by: Steven sun <98230804+Tuyohai@users.noreply.github.com> Co-authored-by: steven <sunzwj@digitalchina.com> Co-authored-by: Kalo Chin <91766386+fdb02983rhy@users.noreply.github.com> Co-authored-by: Katy Tao <34019945+KatyTao@users.noreply.github.com> Co-authored-by: depy <42985524+h4ckdepy@users.noreply.github.com> Co-authored-by: 胡春东 <gycm520@gmail.com> Co-authored-by: Junjie.M <118170653@qq.com> Co-authored-by: MuYu <mr.muzea@gmail.com> Co-authored-by: Naoki Takashima <39912547+takatea@users.noreply.github.com> Co-authored-by: Summer-Gu <37869445+gubinjie@users.noreply.github.com> Co-authored-by: Fei He <droxer.he@gmail.com> Co-authored-by: ybalbert001 <120714773+ybalbert001@users.noreply.github.com> Co-authored-by: Yuanbo Li <ybalbert@amazon.com> Co-authored-by: douxc <7553076+douxc@users.noreply.github.com> Co-authored-by: liuzhenghua <1090179900@qq.com> Co-authored-by: Wu Jiayang <62842862+Wu-Jiayang@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: kimjion <45935338+kimjion@users.noreply.github.com> Co-authored-by: AugNSo <song.tiankai@icloud.com> Co-authored-by: llinvokerl <38915183+llinvokerl@users.noreply.github.com> Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com> Co-authored-by: Vasu Negi <vasu-negi@users.noreply.github.com> Co-authored-by: Hundredwz <1808096180@qq.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
8 months ago
Introduce Plugins (#13836) Signed-off-by: yihong0618 <zouzou0208@gmail.com> Signed-off-by: -LAN- <laipz8200@outlook.com> Signed-off-by: xhe <xw897002528@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: takatost <takatost@gmail.com> Co-authored-by: kurokobo <kuro664@gmail.com> Co-authored-by: Novice Lee <novicelee@NoviPro.local> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: AkaraChen <akarachen@outlook.com> Co-authored-by: Yi <yxiaoisme@gmail.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: Hiroshi Fujita <fujita-h@users.noreply.github.com> Co-authored-by: AkaraChen <85140972+AkaraChen@users.noreply.github.com> Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: Novice <857526207@qq.com> Co-authored-by: Hiroki Nagai <82458324+nagaihiroki-git@users.noreply.github.com> Co-authored-by: Gen Sato <52241300+halogen22@users.noreply.github.com> Co-authored-by: eux <euxuuu@gmail.com> Co-authored-by: huangzhuo1949 <167434202+huangzhuo1949@users.noreply.github.com> Co-authored-by: huangzhuo <huangzhuo1@xiaomi.com> Co-authored-by: lotsik <lotsik@mail.ru> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: gakkiyomi <gakkiyomi@aliyun.com> Co-authored-by: CN-P5 <heibai2006@gmail.com> Co-authored-by: CN-P5 <heibai2006@qq.com> Co-authored-by: Chuehnone <1897025+chuehnone@users.noreply.github.com> Co-authored-by: yihong <zouzou0208@gmail.com> Co-authored-by: Kevin9703 <51311316+Kevin9703@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com> Co-authored-by: Boris Feld <lothiraldan@gmail.com> Co-authored-by: mbo <himabo@gmail.com> Co-authored-by: mabo <mabo@aeyes.ai> Co-authored-by: Warren Chen <warren.chen830@gmail.com> Co-authored-by: JzoNgKVO <27049666+JzoNgKVO@users.noreply.github.com> Co-authored-by: jiandanfeng <chenjh3@wangsu.com> Co-authored-by: zhu-an <70234959+xhdd123321@users.noreply.github.com> Co-authored-by: zhaoqingyu.1075 <zhaoqingyu.1075@bytedance.com> Co-authored-by: 海狸大師 <86974027+yenslife@users.noreply.github.com> Co-authored-by: Xu Song <xusong.vip@gmail.com> Co-authored-by: rayshaw001 <396301947@163.com> Co-authored-by: Ding Jiatong <dingjiatong@gmail.com> Co-authored-by: Bowen Liang <liangbowen@gf.com.cn> Co-authored-by: JasonVV <jasonwangiii@outlook.com> Co-authored-by: le0zh <newlight@qq.com> Co-authored-by: zhuxinliang <zhuxinliang@didiglobal.com> Co-authored-by: k-zaku <zaku99@outlook.jp> Co-authored-by: luckylhb90 <luckylhb90@gmail.com> Co-authored-by: hobo.l <hobo.l@binance.com> Co-authored-by: jiangbo721 <365065261@qq.com> Co-authored-by: 刘江波 <jiangbo721@163.com> Co-authored-by: Shun Miyazawa <34241526+miya@users.noreply.github.com> Co-authored-by: EricPan <30651140+Egfly@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: sino <sino2322@gmail.com> Co-authored-by: Jhvcc <37662342+Jhvcc@users.noreply.github.com> Co-authored-by: lowell <lowell.hu@zkteco.in> Co-authored-by: Boris Polonsky <BorisPolonsky@users.noreply.github.com> Co-authored-by: Ademílson Tonato <ademilsonft@outlook.com> Co-authored-by: Ademílson Tonato <ademilson.tonato@refurbed.com> Co-authored-by: IWAI, Masaharu <iwaim.sub@gmail.com> Co-authored-by: Yueh-Po Peng (Yabi) <94939112+y10ab1@users.noreply.github.com> Co-authored-by: Jason <ggbbddjm@gmail.com> Co-authored-by: Xin Zhang <sjhpzx@gmail.com> Co-authored-by: yjc980121 <3898524+yjc980121@users.noreply.github.com> Co-authored-by: heyszt <36215648+hieheihei@users.noreply.github.com> Co-authored-by: Abdullah AlOsaimi <osaimiacc@gmail.com> Co-authored-by: Abdullah AlOsaimi <189027247+osaimi@users.noreply.github.com> Co-authored-by: Yingchun Lai <laiyingchun@apache.org> Co-authored-by: Hash Brown <hi@xzd.me> Co-authored-by: zuodongxu <192560071+zuodongxu@users.noreply.github.com> Co-authored-by: Masashi Tomooka <tmokmss@users.noreply.github.com> Co-authored-by: aplio <ryo.091219@gmail.com> Co-authored-by: Obada Khalili <54270856+obadakhalili@users.noreply.github.com> Co-authored-by: Nam Vu <zuzoovn@gmail.com> Co-authored-by: Kei YAMAZAKI <1715090+kei-yamazaki@users.noreply.github.com> Co-authored-by: TechnoHouse <13776377+deephbz@users.noreply.github.com> Co-authored-by: Riddhimaan-Senapati <114703025+Riddhimaan-Senapati@users.noreply.github.com> Co-authored-by: MaFee921 <31881301+2284730142@users.noreply.github.com> Co-authored-by: te-chan <t-nakanome@sakura-is.co.jp> Co-authored-by: HQidea <HQidea@users.noreply.github.com> Co-authored-by: Joshbly <36315710+Joshbly@users.noreply.github.com> Co-authored-by: xhe <xw897002528@gmail.com> Co-authored-by: weiwenyan-dev <154779315+weiwenyan-dev@users.noreply.github.com> Co-authored-by: ex_wenyan.wei <ex_wenyan.wei@tcl.com> Co-authored-by: engchina <12236799+engchina@users.noreply.github.com> Co-authored-by: engchina <atjapan2015@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: 呆萌闷油瓶 <253605712@qq.com> Co-authored-by: Kemal <kemalmeler@outlook.com> Co-authored-by: Lazy_Frog <4590648+lazyFrogLOL@users.noreply.github.com> Co-authored-by: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Co-authored-by: Steven sun <98230804+Tuyohai@users.noreply.github.com> Co-authored-by: steven <sunzwj@digitalchina.com> Co-authored-by: Kalo Chin <91766386+fdb02983rhy@users.noreply.github.com> Co-authored-by: Katy Tao <34019945+KatyTao@users.noreply.github.com> Co-authored-by: depy <42985524+h4ckdepy@users.noreply.github.com> Co-authored-by: 胡春东 <gycm520@gmail.com> Co-authored-by: Junjie.M <118170653@qq.com> Co-authored-by: MuYu <mr.muzea@gmail.com> Co-authored-by: Naoki Takashima <39912547+takatea@users.noreply.github.com> Co-authored-by: Summer-Gu <37869445+gubinjie@users.noreply.github.com> Co-authored-by: Fei He <droxer.he@gmail.com> Co-authored-by: ybalbert001 <120714773+ybalbert001@users.noreply.github.com> Co-authored-by: Yuanbo Li <ybalbert@amazon.com> Co-authored-by: douxc <7553076+douxc@users.noreply.github.com> Co-authored-by: liuzhenghua <1090179900@qq.com> Co-authored-by: Wu Jiayang <62842862+Wu-Jiayang@users.noreply.github.com> Co-authored-by: Your Name <you@example.com> Co-authored-by: kimjion <45935338+kimjion@users.noreply.github.com> Co-authored-by: AugNSo <song.tiankai@icloud.com> Co-authored-by: llinvokerl <38915183+llinvokerl@users.noreply.github.com> Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com> Co-authored-by: Vasu Negi <vasu-negi@users.noreply.github.com> Co-authored-by: Hundredwz <1808096180@qq.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
8 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
5 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
4 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146
  1. import logging
  2. from argparse import ArgumentTypeError
  3. from datetime import UTC, datetime
  4. from typing import cast
  5. from flask import request
  6. from flask_login import current_user
  7. from flask_restful import Resource, fields, marshal, marshal_with, reqparse
  8. from sqlalchemy import asc, desc, select
  9. from werkzeug.exceptions import Forbidden, NotFound
  10. import services
  11. from controllers.console import api
  12. from controllers.console.app.error import (
  13. ProviderModelCurrentlyNotSupportError,
  14. ProviderNotInitializeError,
  15. ProviderQuotaExceededError,
  16. )
  17. from controllers.console.datasets.error import (
  18. ArchivedDocumentImmutableError,
  19. DocumentAlreadyFinishedError,
  20. DocumentIndexingError,
  21. IndexingEstimateError,
  22. InvalidActionError,
  23. InvalidMetadataError,
  24. )
  25. from controllers.console.wraps import (
  26. account_initialization_required,
  27. cloud_edition_billing_rate_limit_check,
  28. cloud_edition_billing_resource_check,
  29. setup_required,
  30. )
  31. from core.errors.error import (
  32. LLMBadRequestError,
  33. ModelCurrentlyNotSupportError,
  34. ProviderTokenNotInitError,
  35. QuotaExceededError,
  36. )
  37. from core.indexing_runner import IndexingRunner
  38. from core.model_manager import ModelManager
  39. from core.model_runtime.entities.model_entities import ModelType
  40. from core.model_runtime.errors.invoke import InvokeAuthorizationError
  41. from core.plugin.impl.exc import PluginDaemonClientSideError
  42. from core.rag.extractor.entity.extract_setting import ExtractSetting
  43. from extensions.ext_database import db
  44. from extensions.ext_redis import redis_client
  45. from fields.document_fields import (
  46. dataset_and_document_fields,
  47. document_fields,
  48. document_status_fields,
  49. document_with_segments_fields,
  50. )
  51. from libs.login import login_required
  52. from models import Dataset, DatasetProcessRule, Document, DocumentSegment, UploadFile
  53. from models.dataset import DocumentPipelineExecutionLog
  54. from services.dataset_service import DatasetService, DocumentService
  55. from services.entities.knowledge_entities.knowledge_entities import KnowledgeConfig
  56. from tasks.add_document_to_index_task import add_document_to_index_task
  57. from tasks.remove_document_from_index_task import remove_document_from_index_task
  58. class DocumentResource(Resource):
  59. def get_document(self, dataset_id: str, document_id: str) -> Document:
  60. dataset = DatasetService.get_dataset(dataset_id)
  61. if not dataset:
  62. raise NotFound("Dataset not found.")
  63. try:
  64. DatasetService.check_dataset_permission(dataset, current_user)
  65. except services.errors.account.NoPermissionError as e:
  66. raise Forbidden(str(e))
  67. document = DocumentService.get_document(dataset_id, document_id)
  68. if not document:
  69. raise NotFound("Document not found.")
  70. if document.tenant_id != current_user.current_tenant_id:
  71. raise Forbidden("No permission.")
  72. return document
  73. def get_batch_documents(self, dataset_id: str, batch: str) -> list[Document]:
  74. dataset = DatasetService.get_dataset(dataset_id)
  75. if not dataset:
  76. raise NotFound("Dataset not found.")
  77. try:
  78. DatasetService.check_dataset_permission(dataset, current_user)
  79. except services.errors.account.NoPermissionError as e:
  80. raise Forbidden(str(e))
  81. documents = DocumentService.get_batch_documents(dataset_id, batch)
  82. if not documents:
  83. raise NotFound("Documents not found.")
  84. return documents
  85. class GetProcessRuleApi(Resource):
  86. @setup_required
  87. @login_required
  88. @account_initialization_required
  89. def get(self):
  90. req_data = request.args
  91. document_id = req_data.get("document_id")
  92. # get default rules
  93. mode = DocumentService.DEFAULT_RULES["mode"]
  94. rules = DocumentService.DEFAULT_RULES["rules"]
  95. limits = DocumentService.DEFAULT_RULES["limits"]
  96. if document_id:
  97. # get the latest process rule
  98. document = db.get_or_404(Document, document_id)
  99. dataset = DatasetService.get_dataset(document.dataset_id)
  100. if not dataset:
  101. raise NotFound("Dataset not found.")
  102. try:
  103. DatasetService.check_dataset_permission(dataset, current_user)
  104. except services.errors.account.NoPermissionError as e:
  105. raise Forbidden(str(e))
  106. # get the latest process rule
  107. dataset_process_rule = (
  108. db.session.query(DatasetProcessRule)
  109. .filter(DatasetProcessRule.dataset_id == document.dataset_id)
  110. .order_by(DatasetProcessRule.created_at.desc())
  111. .limit(1)
  112. .one_or_none()
  113. )
  114. if dataset_process_rule:
  115. mode = dataset_process_rule.mode
  116. rules = dataset_process_rule.rules_dict
  117. return {"mode": mode, "rules": rules, "limits": limits}
  118. class DatasetDocumentListApi(Resource):
  119. @setup_required
  120. @login_required
  121. @account_initialization_required
  122. def get(self, dataset_id):
  123. dataset_id = str(dataset_id)
  124. page = request.args.get("page", default=1, type=int)
  125. limit = request.args.get("limit", default=20, type=int)
  126. search = request.args.get("keyword", default=None, type=str)
  127. sort = request.args.get("sort", default="-created_at", type=str)
  128. # "yes", "true", "t", "y", "1" convert to True, while others convert to False.
  129. try:
  130. fetch_val = request.args.get("fetch", default="false")
  131. if isinstance(fetch_val, bool):
  132. fetch = fetch_val
  133. else:
  134. if fetch_val.lower() in ("yes", "true", "t", "y", "1"):
  135. fetch = True
  136. elif fetch_val.lower() in ("no", "false", "f", "n", "0"):
  137. fetch = False
  138. else:
  139. raise ArgumentTypeError(
  140. f"Truthy value expected: got {fetch_val} but expected one of yes/no, true/false, t/f, y/n, 1/0 "
  141. f"(case insensitive)."
  142. )
  143. except (ArgumentTypeError, ValueError, Exception):
  144. fetch = False
  145. dataset = DatasetService.get_dataset(dataset_id)
  146. if not dataset:
  147. raise NotFound("Dataset not found.")
  148. try:
  149. DatasetService.check_dataset_permission(dataset, current_user)
  150. except services.errors.account.NoPermissionError as e:
  151. raise Forbidden(str(e))
  152. query = select(Document).filter_by(dataset_id=str(dataset_id), tenant_id=current_user.current_tenant_id)
  153. if search:
  154. search = f"%{search}%"
  155. query = query.filter(Document.name.like(search))
  156. if sort.startswith("-"):
  157. sort_logic = desc
  158. sort = sort[1:]
  159. else:
  160. sort_logic = asc
  161. if sort == "hit_count":
  162. sub_query = (
  163. db.select(DocumentSegment.document_id, db.func.sum(DocumentSegment.hit_count).label("total_hit_count"))
  164. .group_by(DocumentSegment.document_id)
  165. .subquery()
  166. )
  167. query = query.outerjoin(sub_query, sub_query.c.document_id == Document.id).order_by(
  168. sort_logic(db.func.coalesce(sub_query.c.total_hit_count, 0)),
  169. sort_logic(Document.position),
  170. )
  171. elif sort == "created_at":
  172. query = query.order_by(
  173. sort_logic(Document.created_at),
  174. sort_logic(Document.position),
  175. )
  176. else:
  177. query = query.order_by(
  178. desc(Document.created_at),
  179. desc(Document.position),
  180. )
  181. paginated_documents = db.paginate(select=query, page=page, per_page=limit, max_per_page=100, error_out=False)
  182. documents = paginated_documents.items
  183. if fetch:
  184. for document in documents:
  185. completed_segments = (
  186. db.session.query(DocumentSegment)
  187. .filter(
  188. DocumentSegment.completed_at.isnot(None),
  189. DocumentSegment.document_id == str(document.id),
  190. DocumentSegment.status != "re_segment",
  191. )
  192. .count()
  193. )
  194. total_segments = (
  195. db.session.query(DocumentSegment)
  196. .filter(DocumentSegment.document_id == str(document.id), DocumentSegment.status != "re_segment")
  197. .count()
  198. )
  199. document.completed_segments = completed_segments
  200. document.total_segments = total_segments
  201. data = marshal(documents, document_with_segments_fields)
  202. else:
  203. data = marshal(documents, document_fields)
  204. response = {
  205. "data": data,
  206. "has_more": len(documents) == limit,
  207. "limit": limit,
  208. "total": paginated_documents.total,
  209. "page": page,
  210. }
  211. return response
  212. documents_and_batch_fields = {"documents": fields.List(fields.Nested(document_fields)), "batch": fields.String}
  213. @setup_required
  214. @login_required
  215. @account_initialization_required
  216. @marshal_with(documents_and_batch_fields)
  217. @cloud_edition_billing_resource_check("vector_space")
  218. @cloud_edition_billing_rate_limit_check("knowledge")
  219. def post(self, dataset_id):
  220. dataset_id = str(dataset_id)
  221. dataset = DatasetService.get_dataset(dataset_id)
  222. if not dataset:
  223. raise NotFound("Dataset not found.")
  224. # The role of the current user in the ta table must be admin, owner, or editor
  225. if not current_user.is_dataset_editor:
  226. raise Forbidden()
  227. try:
  228. DatasetService.check_dataset_permission(dataset, current_user)
  229. except services.errors.account.NoPermissionError as e:
  230. raise Forbidden(str(e))
  231. parser = reqparse.RequestParser()
  232. parser.add_argument(
  233. "indexing_technique", type=str, choices=Dataset.INDEXING_TECHNIQUE_LIST, nullable=False, location="json"
  234. )
  235. parser.add_argument("data_source", type=dict, required=False, location="json")
  236. parser.add_argument("process_rule", type=dict, required=False, location="json")
  237. parser.add_argument("duplicate", type=bool, default=True, nullable=False, location="json")
  238. parser.add_argument("original_document_id", type=str, required=False, location="json")
  239. parser.add_argument("doc_form", type=str, default="text_model", required=False, nullable=False, location="json")
  240. parser.add_argument("retrieval_model", type=dict, required=False, nullable=False, location="json")
  241. parser.add_argument("embedding_model", type=str, required=False, nullable=True, location="json")
  242. parser.add_argument("embedding_model_provider", type=str, required=False, nullable=True, location="json")
  243. parser.add_argument(
  244. "doc_language", type=str, default="English", required=False, nullable=False, location="json"
  245. )
  246. args = parser.parse_args()
  247. knowledge_config = KnowledgeConfig(**args)
  248. if not dataset.indexing_technique and not knowledge_config.indexing_technique:
  249. raise ValueError("indexing_technique is required.")
  250. # validate args
  251. DocumentService.document_create_args_validate(knowledge_config)
  252. try:
  253. documents, batch = DocumentService.save_document_with_dataset_id(dataset, knowledge_config, current_user)
  254. except ProviderTokenNotInitError as ex:
  255. raise ProviderNotInitializeError(ex.description)
  256. except QuotaExceededError:
  257. raise ProviderQuotaExceededError()
  258. except ModelCurrentlyNotSupportError:
  259. raise ProviderModelCurrentlyNotSupportError()
  260. return {"documents": documents, "batch": batch}
  261. @setup_required
  262. @login_required
  263. @account_initialization_required
  264. @cloud_edition_billing_rate_limit_check("knowledge")
  265. def delete(self, dataset_id):
  266. dataset_id = str(dataset_id)
  267. dataset = DatasetService.get_dataset(dataset_id)
  268. if dataset is None:
  269. raise NotFound("Dataset not found.")
  270. # check user's model setting
  271. DatasetService.check_dataset_model_setting(dataset)
  272. try:
  273. document_ids = request.args.getlist("document_id")
  274. DocumentService.delete_documents(dataset, document_ids)
  275. except services.errors.document.DocumentIndexingError:
  276. raise DocumentIndexingError("Cannot delete document during indexing.")
  277. return {"result": "success"}, 204
  278. class DatasetInitApi(Resource):
  279. @setup_required
  280. @login_required
  281. @account_initialization_required
  282. @marshal_with(dataset_and_document_fields)
  283. @cloud_edition_billing_resource_check("vector_space")
  284. @cloud_edition_billing_rate_limit_check("knowledge")
  285. def post(self):
  286. # The role of the current user in the ta table must be admin, owner, dataset_operator, or editor
  287. if not current_user.is_dataset_editor:
  288. raise Forbidden()
  289. parser = reqparse.RequestParser()
  290. parser.add_argument(
  291. "indexing_technique",
  292. type=str,
  293. choices=Dataset.INDEXING_TECHNIQUE_LIST,
  294. required=True,
  295. nullable=False,
  296. location="json",
  297. )
  298. parser.add_argument("data_source", type=dict, required=True, nullable=True, location="json")
  299. parser.add_argument("process_rule", type=dict, required=True, nullable=True, location="json")
  300. parser.add_argument("doc_form", type=str, default="text_model", required=False, nullable=False, location="json")
  301. parser.add_argument(
  302. "doc_language", type=str, default="English", required=False, nullable=False, location="json"
  303. )
  304. parser.add_argument("retrieval_model", type=dict, required=False, nullable=False, location="json")
  305. parser.add_argument("embedding_model", type=str, required=False, nullable=True, location="json")
  306. parser.add_argument("embedding_model_provider", type=str, required=False, nullable=True, location="json")
  307. args = parser.parse_args()
  308. # The role of the current user in the ta table must be admin, owner, or editor, or dataset_operator
  309. if not current_user.is_dataset_editor:
  310. raise Forbidden()
  311. knowledge_config = KnowledgeConfig(**args)
  312. if knowledge_config.indexing_technique == "high_quality":
  313. if knowledge_config.embedding_model is None or knowledge_config.embedding_model_provider is None:
  314. raise ValueError("embedding model and embedding model provider are required for high quality indexing.")
  315. try:
  316. model_manager = ModelManager()
  317. model_manager.get_model_instance(
  318. tenant_id=current_user.current_tenant_id,
  319. provider=args["embedding_model_provider"],
  320. model_type=ModelType.TEXT_EMBEDDING,
  321. model=args["embedding_model"],
  322. )
  323. except InvokeAuthorizationError:
  324. raise ProviderNotInitializeError(
  325. "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider."
  326. )
  327. except ProviderTokenNotInitError as ex:
  328. raise ProviderNotInitializeError(ex.description)
  329. # validate args
  330. DocumentService.document_create_args_validate(knowledge_config)
  331. try:
  332. dataset, documents, batch = DocumentService.save_document_without_dataset_id(
  333. tenant_id=current_user.current_tenant_id, knowledge_config=knowledge_config, account=current_user
  334. )
  335. except ProviderTokenNotInitError as ex:
  336. raise ProviderNotInitializeError(ex.description)
  337. except QuotaExceededError:
  338. raise ProviderQuotaExceededError()
  339. except ModelCurrentlyNotSupportError:
  340. raise ProviderModelCurrentlyNotSupportError()
  341. response = {"dataset": dataset, "documents": documents, "batch": batch}
  342. return response
  343. class DocumentIndexingEstimateApi(DocumentResource):
  344. @setup_required
  345. @login_required
  346. @account_initialization_required
  347. def get(self, dataset_id, document_id):
  348. dataset_id = str(dataset_id)
  349. document_id = str(document_id)
  350. document = self.get_document(dataset_id, document_id)
  351. if document.indexing_status in {"completed", "error"}:
  352. raise DocumentAlreadyFinishedError()
  353. data_process_rule = document.dataset_process_rule
  354. data_process_rule_dict = data_process_rule.to_dict()
  355. response = {"tokens": 0, "total_price": 0, "currency": "USD", "total_segments": 0, "preview": []}
  356. if document.data_source_type == "upload_file":
  357. data_source_info = document.data_source_info_dict
  358. if data_source_info and "upload_file_id" in data_source_info:
  359. file_id = data_source_info["upload_file_id"]
  360. file = (
  361. db.session.query(UploadFile)
  362. .filter(UploadFile.tenant_id == document.tenant_id, UploadFile.id == file_id)
  363. .first()
  364. )
  365. # raise error if file not found
  366. if not file:
  367. raise NotFound("File not found.")
  368. extract_setting = ExtractSetting(
  369. datasource_type="upload_file", upload_file=file, document_model=document.doc_form
  370. )
  371. indexing_runner = IndexingRunner()
  372. try:
  373. estimate_response = indexing_runner.indexing_estimate(
  374. current_user.current_tenant_id,
  375. [extract_setting],
  376. data_process_rule_dict,
  377. document.doc_form,
  378. "English",
  379. dataset_id,
  380. )
  381. return estimate_response.model_dump(), 200
  382. except LLMBadRequestError:
  383. raise ProviderNotInitializeError(
  384. "No Embedding Model available. Please configure a valid provider "
  385. "in the Settings -> Model Provider."
  386. )
  387. except ProviderTokenNotInitError as ex:
  388. raise ProviderNotInitializeError(ex.description)
  389. except PluginDaemonClientSideError as ex:
  390. raise ProviderNotInitializeError(ex.description)
  391. except Exception as e:
  392. raise IndexingEstimateError(str(e))
  393. return response, 200
  394. class DocumentBatchIndexingEstimateApi(DocumentResource):
  395. @setup_required
  396. @login_required
  397. @account_initialization_required
  398. def get(self, dataset_id, batch):
  399. dataset_id = str(dataset_id)
  400. batch = str(batch)
  401. documents = self.get_batch_documents(dataset_id, batch)
  402. if not documents:
  403. return {"tokens": 0, "total_price": 0, "currency": "USD", "total_segments": 0, "preview": []}, 200
  404. data_process_rule = documents[0].dataset_process_rule
  405. data_process_rule_dict = data_process_rule.to_dict()
  406. info_list = []
  407. extract_settings = []
  408. for document in documents:
  409. if document.indexing_status in {"completed", "error"}:
  410. raise DocumentAlreadyFinishedError()
  411. data_source_info = document.data_source_info_dict
  412. # format document files info
  413. if data_source_info and "upload_file_id" in data_source_info:
  414. file_id = data_source_info["upload_file_id"]
  415. info_list.append(file_id)
  416. # format document notion info
  417. elif (
  418. data_source_info and "notion_workspace_id" in data_source_info and "notion_page_id" in data_source_info
  419. ):
  420. pages = []
  421. page = {"page_id": data_source_info["notion_page_id"], "type": data_source_info["type"]}
  422. pages.append(page)
  423. notion_info = {"workspace_id": data_source_info["notion_workspace_id"], "pages": pages}
  424. info_list.append(notion_info)
  425. if document.data_source_type == "upload_file":
  426. file_id = data_source_info["upload_file_id"]
  427. file_detail = (
  428. db.session.query(UploadFile)
  429. .filter(UploadFile.tenant_id == current_user.current_tenant_id, UploadFile.id == file_id)
  430. .first()
  431. )
  432. if file_detail is None:
  433. raise NotFound("File not found.")
  434. extract_setting = ExtractSetting(
  435. datasource_type="upload_file", upload_file=file_detail, document_model=document.doc_form
  436. )
  437. extract_settings.append(extract_setting)
  438. elif document.data_source_type == "notion_import":
  439. extract_setting = ExtractSetting(
  440. datasource_type="notion_import",
  441. notion_info={
  442. "notion_workspace_id": data_source_info["notion_workspace_id"],
  443. "notion_obj_id": data_source_info["notion_page_id"],
  444. "notion_page_type": data_source_info["type"],
  445. "tenant_id": current_user.current_tenant_id,
  446. },
  447. document_model=document.doc_form,
  448. )
  449. extract_settings.append(extract_setting)
  450. elif document.data_source_type == "website_crawl":
  451. extract_setting = ExtractSetting(
  452. datasource_type="website_crawl",
  453. website_info={
  454. "provider": data_source_info["provider"],
  455. "job_id": data_source_info["job_id"],
  456. "url": data_source_info["url"],
  457. "tenant_id": current_user.current_tenant_id,
  458. "mode": data_source_info["mode"],
  459. "only_main_content": data_source_info["only_main_content"],
  460. },
  461. document_model=document.doc_form,
  462. )
  463. extract_settings.append(extract_setting)
  464. else:
  465. raise ValueError("Data source type not support")
  466. indexing_runner = IndexingRunner()
  467. try:
  468. response = indexing_runner.indexing_estimate(
  469. current_user.current_tenant_id,
  470. extract_settings,
  471. data_process_rule_dict,
  472. document.doc_form,
  473. "English",
  474. dataset_id,
  475. )
  476. return response.model_dump(), 200
  477. except LLMBadRequestError:
  478. raise ProviderNotInitializeError(
  479. "No Embedding Model available. Please configure a valid provider in the Settings -> Model Provider."
  480. )
  481. except ProviderTokenNotInitError as ex:
  482. raise ProviderNotInitializeError(ex.description)
  483. except PluginDaemonClientSideError as ex:
  484. raise ProviderNotInitializeError(ex.description)
  485. except Exception as e:
  486. raise IndexingEstimateError(str(e))
  487. class DocumentBatchIndexingStatusApi(DocumentResource):
  488. @setup_required
  489. @login_required
  490. @account_initialization_required
  491. def get(self, dataset_id, batch):
  492. dataset_id = str(dataset_id)
  493. batch = str(batch)
  494. documents = self.get_batch_documents(dataset_id, batch)
  495. documents_status = []
  496. for document in documents:
  497. completed_segments = (
  498. db.session.query(DocumentSegment)
  499. .filter(
  500. DocumentSegment.completed_at.isnot(None),
  501. DocumentSegment.document_id == str(document.id),
  502. DocumentSegment.status != "re_segment",
  503. )
  504. .count()
  505. )
  506. total_segments = (
  507. db.session.query(DocumentSegment)
  508. .filter(DocumentSegment.document_id == str(document.id), DocumentSegment.status != "re_segment")
  509. .count()
  510. )
  511. # Create a dictionary with document attributes and additional fields
  512. document_dict = {
  513. "id": document.id,
  514. "indexing_status": "paused" if document.is_paused else document.indexing_status,
  515. "processing_started_at": document.processing_started_at,
  516. "parsing_completed_at": document.parsing_completed_at,
  517. "cleaning_completed_at": document.cleaning_completed_at,
  518. "splitting_completed_at": document.splitting_completed_at,
  519. "completed_at": document.completed_at,
  520. "paused_at": document.paused_at,
  521. "error": document.error,
  522. "stopped_at": document.stopped_at,
  523. "completed_segments": completed_segments,
  524. "total_segments": total_segments,
  525. }
  526. documents_status.append(marshal(document_dict, document_status_fields))
  527. data = {"data": documents_status}
  528. return data
  529. class DocumentIndexingStatusApi(DocumentResource):
  530. @setup_required
  531. @login_required
  532. @account_initialization_required
  533. def get(self, dataset_id, document_id):
  534. dataset_id = str(dataset_id)
  535. document_id = str(document_id)
  536. document = self.get_document(dataset_id, document_id)
  537. completed_segments = (
  538. db.session.query(DocumentSegment)
  539. .filter(
  540. DocumentSegment.completed_at.isnot(None),
  541. DocumentSegment.document_id == str(document_id),
  542. DocumentSegment.status != "re_segment",
  543. )
  544. .count()
  545. )
  546. total_segments = (
  547. db.session.query(DocumentSegment)
  548. .filter(DocumentSegment.document_id == str(document_id), DocumentSegment.status != "re_segment")
  549. .count()
  550. )
  551. # Create a dictionary with document attributes and additional fields
  552. document_dict = {
  553. "id": document.id,
  554. "indexing_status": "paused" if document.is_paused else document.indexing_status,
  555. "processing_started_at": document.processing_started_at,
  556. "parsing_completed_at": document.parsing_completed_at,
  557. "cleaning_completed_at": document.cleaning_completed_at,
  558. "splitting_completed_at": document.splitting_completed_at,
  559. "completed_at": document.completed_at,
  560. "paused_at": document.paused_at,
  561. "error": document.error,
  562. "stopped_at": document.stopped_at,
  563. "completed_segments": completed_segments,
  564. "total_segments": total_segments,
  565. }
  566. return marshal(document_dict, document_status_fields)
  567. class DocumentDetailApi(DocumentResource):
  568. METADATA_CHOICES = {"all", "only", "without"}
  569. @setup_required
  570. @login_required
  571. @account_initialization_required
  572. def get(self, dataset_id, document_id):
  573. dataset_id = str(dataset_id)
  574. document_id = str(document_id)
  575. document = self.get_document(dataset_id, document_id)
  576. metadata = request.args.get("metadata", "all")
  577. if metadata not in self.METADATA_CHOICES:
  578. raise InvalidMetadataError(f"Invalid metadata value: {metadata}")
  579. if metadata == "only":
  580. response = {"id": document.id, "doc_type": document.doc_type, "doc_metadata": document.doc_metadata_details}
  581. elif metadata == "without":
  582. dataset_process_rules = DatasetService.get_process_rules(dataset_id)
  583. document_process_rules = document.dataset_process_rule.to_dict() if document.dataset_process_rule else {}
  584. data_source_info = document.data_source_detail_dict
  585. response = {
  586. "id": document.id,
  587. "position": document.position,
  588. "data_source_type": document.data_source_type,
  589. "data_source_info": data_source_info,
  590. "dataset_process_rule_id": document.dataset_process_rule_id,
  591. "dataset_process_rule": dataset_process_rules,
  592. "document_process_rule": document_process_rules,
  593. "name": document.name,
  594. "created_from": document.created_from,
  595. "created_by": document.created_by,
  596. "created_at": document.created_at.timestamp(),
  597. "tokens": document.tokens,
  598. "indexing_status": document.indexing_status,
  599. "completed_at": int(document.completed_at.timestamp()) if document.completed_at else None,
  600. "updated_at": int(document.updated_at.timestamp()) if document.updated_at else None,
  601. "indexing_latency": document.indexing_latency,
  602. "error": document.error,
  603. "enabled": document.enabled,
  604. "disabled_at": int(document.disabled_at.timestamp()) if document.disabled_at else None,
  605. "disabled_by": document.disabled_by,
  606. "archived": document.archived,
  607. "segment_count": document.segment_count,
  608. "average_segment_length": document.average_segment_length,
  609. "hit_count": document.hit_count,
  610. "display_status": document.display_status,
  611. "doc_form": document.doc_form,
  612. "doc_language": document.doc_language,
  613. }
  614. else:
  615. dataset_process_rules = DatasetService.get_process_rules(dataset_id)
  616. document_process_rules = document.dataset_process_rule.to_dict()
  617. data_source_info = document.data_source_detail_dict
  618. response = {
  619. "id": document.id,
  620. "position": document.position,
  621. "data_source_type": document.data_source_type,
  622. "data_source_info": data_source_info,
  623. "dataset_process_rule_id": document.dataset_process_rule_id,
  624. "dataset_process_rule": dataset_process_rules,
  625. "document_process_rule": document_process_rules,
  626. "name": document.name,
  627. "created_from": document.created_from,
  628. "created_by": document.created_by,
  629. "created_at": document.created_at.timestamp(),
  630. "tokens": document.tokens,
  631. "indexing_status": document.indexing_status,
  632. "completed_at": int(document.completed_at.timestamp()) if document.completed_at else None,
  633. "updated_at": int(document.updated_at.timestamp()) if document.updated_at else None,
  634. "indexing_latency": document.indexing_latency,
  635. "error": document.error,
  636. "enabled": document.enabled,
  637. "disabled_at": int(document.disabled_at.timestamp()) if document.disabled_at else None,
  638. "disabled_by": document.disabled_by,
  639. "archived": document.archived,
  640. "doc_type": document.doc_type,
  641. "doc_metadata": document.doc_metadata_details,
  642. "segment_count": document.segment_count,
  643. "average_segment_length": document.average_segment_length,
  644. "hit_count": document.hit_count,
  645. "display_status": document.display_status,
  646. "doc_form": document.doc_form,
  647. "doc_language": document.doc_language,
  648. }
  649. return response, 200
  650. class DocumentProcessingApi(DocumentResource):
  651. @setup_required
  652. @login_required
  653. @account_initialization_required
  654. @cloud_edition_billing_rate_limit_check("knowledge")
  655. def patch(self, dataset_id, document_id, action):
  656. dataset_id = str(dataset_id)
  657. document_id = str(document_id)
  658. document = self.get_document(dataset_id, document_id)
  659. # The role of the current user in the ta table must be admin, owner, dataset_operator, or editor
  660. if not current_user.is_dataset_editor:
  661. raise Forbidden()
  662. if action == "pause":
  663. if document.indexing_status != "indexing":
  664. raise InvalidActionError("Document not in indexing state.")
  665. document.paused_by = current_user.id
  666. document.paused_at = datetime.now(UTC).replace(tzinfo=None)
  667. document.is_paused = True
  668. db.session.commit()
  669. elif action == "resume":
  670. if document.indexing_status not in {"paused", "error"}:
  671. raise InvalidActionError("Document not in paused or error state.")
  672. document.paused_by = None
  673. document.paused_at = None
  674. document.is_paused = False
  675. db.session.commit()
  676. else:
  677. raise InvalidActionError()
  678. return {"result": "success"}, 200
  679. class DocumentDeleteApi(DocumentResource):
  680. @setup_required
  681. @login_required
  682. @account_initialization_required
  683. @cloud_edition_billing_rate_limit_check("knowledge")
  684. def delete(self, dataset_id, document_id):
  685. dataset_id = str(dataset_id)
  686. document_id = str(document_id)
  687. dataset = DatasetService.get_dataset(dataset_id)
  688. if dataset is None:
  689. raise NotFound("Dataset not found.")
  690. # check user's model setting
  691. DatasetService.check_dataset_model_setting(dataset)
  692. document = self.get_document(dataset_id, document_id)
  693. try:
  694. DocumentService.delete_document(document)
  695. except services.errors.document.DocumentIndexingError:
  696. raise DocumentIndexingError("Cannot delete document during indexing.")
  697. return {"result": "success"}, 204
  698. class DocumentMetadataApi(DocumentResource):
  699. @setup_required
  700. @login_required
  701. @account_initialization_required
  702. def put(self, dataset_id, document_id):
  703. dataset_id = str(dataset_id)
  704. document_id = str(document_id)
  705. document = self.get_document(dataset_id, document_id)
  706. req_data = request.get_json()
  707. doc_type = req_data.get("doc_type")
  708. doc_metadata = req_data.get("doc_metadata")
  709. # The role of the current user in the ta table must be admin, owner, dataset_operator, or editor
  710. if not current_user.is_dataset_editor:
  711. raise Forbidden()
  712. if doc_type is None or doc_metadata is None:
  713. raise ValueError("Both doc_type and doc_metadata must be provided.")
  714. if doc_type not in DocumentService.DOCUMENT_METADATA_SCHEMA:
  715. raise ValueError("Invalid doc_type.")
  716. if not isinstance(doc_metadata, dict):
  717. raise ValueError("doc_metadata must be a dictionary.")
  718. metadata_schema: dict = cast(dict, DocumentService.DOCUMENT_METADATA_SCHEMA[doc_type])
  719. document.doc_metadata = {}
  720. if doc_type == "others":
  721. document.doc_metadata = doc_metadata
  722. else:
  723. for key, value_type in metadata_schema.items():
  724. value = doc_metadata.get(key)
  725. if value is not None and isinstance(value, value_type):
  726. document.doc_metadata[key] = value
  727. document.doc_type = doc_type
  728. document.updated_at = datetime.now(UTC).replace(tzinfo=None)
  729. db.session.commit()
  730. return {"result": "success", "message": "Document metadata updated."}, 200
  731. class DocumentStatusApi(DocumentResource):
  732. @setup_required
  733. @login_required
  734. @account_initialization_required
  735. @cloud_edition_billing_resource_check("vector_space")
  736. @cloud_edition_billing_rate_limit_check("knowledge")
  737. def patch(self, dataset_id, action):
  738. dataset_id = str(dataset_id)
  739. dataset = DatasetService.get_dataset(dataset_id)
  740. if dataset is None:
  741. raise NotFound("Dataset not found.")
  742. # The role of the current user in the ta table must be admin, owner, or editor
  743. if not current_user.is_dataset_editor:
  744. raise Forbidden()
  745. # check user's model setting
  746. DatasetService.check_dataset_model_setting(dataset)
  747. # check user's permission
  748. DatasetService.check_dataset_permission(dataset, current_user)
  749. document_ids = request.args.getlist("document_id")
  750. for document_id in document_ids:
  751. document = self.get_document(dataset_id, document_id)
  752. indexing_cache_key = "document_{}_indexing".format(document.id)
  753. cache_result = redis_client.get(indexing_cache_key)
  754. if cache_result is not None:
  755. raise InvalidActionError(f"Document:{document.name} is being indexed, please try again later")
  756. if action == "enable":
  757. if document.enabled:
  758. continue
  759. document.enabled = True
  760. document.disabled_at = None
  761. document.disabled_by = None
  762. document.updated_at = datetime.now(UTC).replace(tzinfo=None)
  763. db.session.commit()
  764. # Set cache to prevent indexing the same document multiple times
  765. redis_client.setex(indexing_cache_key, 600, 1)
  766. add_document_to_index_task.delay(document_id)
  767. elif action == "disable":
  768. if not document.completed_at or document.indexing_status != "completed":
  769. raise InvalidActionError(f"Document: {document.name} is not completed.")
  770. if not document.enabled:
  771. continue
  772. document.enabled = False
  773. document.disabled_at = datetime.now(UTC).replace(tzinfo=None)
  774. document.disabled_by = current_user.id
  775. document.updated_at = datetime.now(UTC).replace(tzinfo=None)
  776. db.session.commit()
  777. # Set cache to prevent indexing the same document multiple times
  778. redis_client.setex(indexing_cache_key, 600, 1)
  779. remove_document_from_index_task.delay(document_id)
  780. elif action == "archive":
  781. if document.archived:
  782. continue
  783. document.archived = True
  784. document.archived_at = datetime.now(UTC).replace(tzinfo=None)
  785. document.archived_by = current_user.id
  786. document.updated_at = datetime.now(UTC).replace(tzinfo=None)
  787. db.session.commit()
  788. if document.enabled:
  789. # Set cache to prevent indexing the same document multiple times
  790. redis_client.setex(indexing_cache_key, 600, 1)
  791. remove_document_from_index_task.delay(document_id)
  792. elif action == "un_archive":
  793. if not document.archived:
  794. continue
  795. document.archived = False
  796. document.archived_at = None
  797. document.archived_by = None
  798. document.updated_at = datetime.now(UTC).replace(tzinfo=None)
  799. db.session.commit()
  800. # Set cache to prevent indexing the same document multiple times
  801. redis_client.setex(indexing_cache_key, 600, 1)
  802. add_document_to_index_task.delay(document_id)
  803. else:
  804. raise InvalidActionError()
  805. return {"result": "success"}, 200
  806. class DocumentPauseApi(DocumentResource):
  807. @setup_required
  808. @login_required
  809. @account_initialization_required
  810. @cloud_edition_billing_rate_limit_check("knowledge")
  811. def patch(self, dataset_id, document_id):
  812. """pause document."""
  813. dataset_id = str(dataset_id)
  814. document_id = str(document_id)
  815. dataset = DatasetService.get_dataset(dataset_id)
  816. if not dataset:
  817. raise NotFound("Dataset not found.")
  818. document = DocumentService.get_document(dataset.id, document_id)
  819. # 404 if document not found
  820. if document is None:
  821. raise NotFound("Document Not Exists.")
  822. # 403 if document is archived
  823. if DocumentService.check_archived(document):
  824. raise ArchivedDocumentImmutableError()
  825. try:
  826. # pause document
  827. DocumentService.pause_document(document)
  828. except services.errors.document.DocumentIndexingError:
  829. raise DocumentIndexingError("Cannot pause completed document.")
  830. return {"result": "success"}, 204
  831. class DocumentRecoverApi(DocumentResource):
  832. @setup_required
  833. @login_required
  834. @account_initialization_required
  835. @cloud_edition_billing_rate_limit_check("knowledge")
  836. def patch(self, dataset_id, document_id):
  837. """recover document."""
  838. dataset_id = str(dataset_id)
  839. document_id = str(document_id)
  840. dataset = DatasetService.get_dataset(dataset_id)
  841. if not dataset:
  842. raise NotFound("Dataset not found.")
  843. document = DocumentService.get_document(dataset.id, document_id)
  844. # 404 if document not found
  845. if document is None:
  846. raise NotFound("Document Not Exists.")
  847. # 403 if document is archived
  848. if DocumentService.check_archived(document):
  849. raise ArchivedDocumentImmutableError()
  850. try:
  851. # pause document
  852. DocumentService.recover_document(document)
  853. except services.errors.document.DocumentIndexingError:
  854. raise DocumentIndexingError("Document is not in paused status.")
  855. return {"result": "success"}, 204
  856. class DocumentRetryApi(DocumentResource):
  857. @setup_required
  858. @login_required
  859. @account_initialization_required
  860. @cloud_edition_billing_rate_limit_check("knowledge")
  861. def post(self, dataset_id):
  862. """retry document."""
  863. parser = reqparse.RequestParser()
  864. parser.add_argument("document_ids", type=list, required=True, nullable=False, location="json")
  865. args = parser.parse_args()
  866. dataset_id = str(dataset_id)
  867. dataset = DatasetService.get_dataset(dataset_id)
  868. retry_documents = []
  869. if not dataset:
  870. raise NotFound("Dataset not found.")
  871. for document_id in args["document_ids"]:
  872. try:
  873. document_id = str(document_id)
  874. document = DocumentService.get_document(dataset.id, document_id)
  875. # 404 if document not found
  876. if document is None:
  877. raise NotFound("Document Not Exists.")
  878. # 403 if document is archived
  879. if DocumentService.check_archived(document):
  880. raise ArchivedDocumentImmutableError()
  881. # 400 if document is completed
  882. if document.indexing_status == "completed":
  883. raise DocumentAlreadyFinishedError()
  884. retry_documents.append(document)
  885. except Exception:
  886. logging.exception(f"Failed to retry document, document id: {document_id}")
  887. continue
  888. # retry document
  889. DocumentService.retry_document(dataset_id, retry_documents)
  890. return {"result": "success"}, 204
  891. class DocumentRenameApi(DocumentResource):
  892. @setup_required
  893. @login_required
  894. @account_initialization_required
  895. @marshal_with(document_fields)
  896. def post(self, dataset_id, document_id):
  897. # The role of the current user in the ta table must be admin, owner, editor, or dataset_operator
  898. if not current_user.is_dataset_editor:
  899. raise Forbidden()
  900. dataset = DatasetService.get_dataset(dataset_id)
  901. DatasetService.check_dataset_operator_permission(current_user, dataset)
  902. parser = reqparse.RequestParser()
  903. parser.add_argument("name", type=str, required=True, nullable=False, location="json")
  904. args = parser.parse_args()
  905. try:
  906. document = DocumentService.rename_document(dataset_id, document_id, args["name"])
  907. except services.errors.document.DocumentIndexingError:
  908. raise DocumentIndexingError("Cannot delete document during indexing.")
  909. return document
  910. class WebsiteDocumentSyncApi(DocumentResource):
  911. @setup_required
  912. @login_required
  913. @account_initialization_required
  914. def get(self, dataset_id, document_id):
  915. """sync website document."""
  916. dataset_id = str(dataset_id)
  917. dataset = DatasetService.get_dataset(dataset_id)
  918. if not dataset:
  919. raise NotFound("Dataset not found.")
  920. document_id = str(document_id)
  921. document = DocumentService.get_document(dataset.id, document_id)
  922. if not document:
  923. raise NotFound("Document not found.")
  924. if document.tenant_id != current_user.current_tenant_id:
  925. raise Forbidden("No permission.")
  926. if document.data_source_type != "website_crawl":
  927. raise ValueError("Document is not a website document.")
  928. # 403 if document is archived
  929. if DocumentService.check_archived(document):
  930. raise ArchivedDocumentImmutableError()
  931. # sync document
  932. DocumentService.sync_website_document(dataset_id, document)
  933. return {"result": "success"}, 200
  934. class DocumentPipelineExecutionLogApi(DocumentResource):
  935. @setup_required
  936. @login_required
  937. @account_initialization_required
  938. def get(self, dataset_id, document_id):
  939. dataset_id = str(dataset_id)
  940. document_id = str(document_id)
  941. dataset = DatasetService.get_dataset(dataset_id)
  942. if not dataset:
  943. raise NotFound("Dataset not found.")
  944. document = DocumentService.get_document(dataset.id, document_id)
  945. if not document:
  946. raise NotFound("Document not found.")
  947. log = (
  948. db.session.query(DocumentPipelineExecutionLog)
  949. .filter_by(document_id=document_id)
  950. .order_by(DocumentPipelineExecutionLog.created_at.desc())
  951. .first()
  952. )
  953. if not log:
  954. return {"datasource_info": None, "datasource_type": None, "input_data": None}, 200
  955. return {
  956. "datasource_info": log.datasource_info,
  957. "datasource_type": log.datasource_type,
  958. "input_data": log.input_data,
  959. }, 200
  960. api.add_resource(GetProcessRuleApi, "/datasets/process-rule")
  961. api.add_resource(DatasetDocumentListApi, "/datasets/<uuid:dataset_id>/documents")
  962. api.add_resource(DatasetInitApi, "/datasets/init")
  963. api.add_resource(
  964. DocumentIndexingEstimateApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/indexing-estimate"
  965. )
  966. api.add_resource(DocumentBatchIndexingEstimateApi, "/datasets/<uuid:dataset_id>/batch/<string:batch>/indexing-estimate")
  967. api.add_resource(DocumentBatchIndexingStatusApi, "/datasets/<uuid:dataset_id>/batch/<string:batch>/indexing-status")
  968. api.add_resource(DocumentIndexingStatusApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/indexing-status")
  969. api.add_resource(DocumentDetailApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>")
  970. api.add_resource(
  971. DocumentProcessingApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/processing/<string:action>"
  972. )
  973. api.add_resource(DocumentDeleteApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>")
  974. api.add_resource(DocumentMetadataApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/metadata")
  975. api.add_resource(DocumentStatusApi, "/datasets/<uuid:dataset_id>/documents/status/<string:action>/batch")
  976. api.add_resource(DocumentPauseApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/processing/pause")
  977. api.add_resource(DocumentRecoverApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/processing/resume")
  978. api.add_resource(DocumentRetryApi, "/datasets/<uuid:dataset_id>/retry")
  979. api.add_resource(DocumentRenameApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/rename")
  980. api.add_resource(WebsiteDocumentSyncApi, "/datasets/<uuid:dataset_id>/documents/<uuid:document_id>/website-sync")