Compare commits

...

197 Commits

Author SHA1 Message Date
AkaraChen
c4e63bc167 build: update headlessui 2024-10-29 14:56:22 +08:00
Joel
6726ca102e feat: add get marketpalce get 2024-10-29 14:53:14 +08:00
Joel
e135707f88 chore: plugin icon not show 2024-10-29 11:57:21 +08:00
Joel
f2765b9d31 feat: fetch plugin icon 2024-10-29 11:47:23 +08:00
StyleZhang
1e0877dcbf feat: marketplace list 2024-10-29 11:33:52 +08:00
StyleZhang
9a65c3391b feat: marketplace list 2024-10-29 10:51:41 +08:00
Joel
ca9e23d6ea fix: check status 2024-10-28 18:36:23 +08:00
AkaraChen
c4d6f9e179 build: update react-easy-crop 2024-10-28 16:46:35 +08:00
Joel
0cec6195a3 test 2024-10-28 16:33:02 +08:00
Joel
966d42a4db Merge branch 'main' into feat/plugins 2024-10-28 15:53:39 +08:00
AkaraChen
15c33ba7f3 build: update lexical deps 2024-10-28 15:33:22 +08:00
AkaraChen
ed7f74c99c build: update i18n pkg 2024-10-28 15:32:39 +08:00
AkaraChen
1db4139b5a build: update deps
build: update classnames

build: update types

build: update uuid

build: update emoji-mart

build: update use-context-selector

build: update ui component deps
2024-10-28 15:24:44 +08:00
StyleZhang
0d85d44de5 feat: marketplace list 2024-10-28 11:50:45 +08:00
AkaraChen
f0f1bfa5d9 build: fix eslint 2024-10-28 11:03:43 +08:00
Joel
9161ce481e Merge branch 'feat/plugins' of https://github.com/langgenius/dify into feat/plugins 2024-10-28 10:59:39 +08:00
Joel
c760902e72 chore: remove useless rule 2024-10-28 10:56:52 +08:00
Joel
7c8c15ef1a test no use rule 2024-10-28 10:56:31 +08:00
Joel
765eb282f3 merge main 2024-10-28 10:51:02 +08:00
AkaraChen
0e2b38dddc build: update qrcode.react 2024-10-25 18:03:25 +08:00
AkaraChen
92e4b3304c build: update deps
build: update sass

build: update lodash-es

build: update qs & js-cookie
2024-10-25 17:58:19 +08:00
Joel
c777d55a1c feat: marketplace install 2024-10-25 16:46:02 +08:00
AkaraChen
cd27ae4319 build: update testing-library 2024-10-25 13:01:39 +08:00
AkaraChen
bd82c7edac build: update storybook 2024-10-25 13:01:39 +08:00
AkaraChen
d5043c6628 build: update husky & lint-staged 2024-10-25 13:01:39 +08:00
AkaraChen
d9a0584052 build: update eslint & fix some case 2024-10-25 12:51:11 +08:00
Joel
3e011109ad merge main 2024-10-25 11:26:49 +08:00
Joel
bdb990eb90 merge main 2024-10-25 11:26:48 +08:00
StyleZhang
ae00211691 feat: marketplace types 2024-10-25 11:15:32 +08:00
StyleZhang
0ef35a0ee0 fix: enable_marketplace 2024-10-25 10:41:25 +08:00
Joel
9a9d90ad7f feat: can install 2024-10-24 17:24:46 +08:00
Joel
606fc7be0c feat: support upload pkg 2024-10-24 17:14:17 +08:00
Joel
d7def41acc feat: fetch debug key api 2024-10-24 16:07:46 +08:00
AkaraChen
b6a560ce86 style: lint 2024-10-24 14:52:07 +08:00
StyleZhang
25f34f6703 fix: marketplace plugin type icon 2024-10-24 14:21:12 +08:00
Joel
7daa365564 chore: to common install comp 2024-10-24 11:10:44 +08:00
Joel
13ccd294cb fix: install error title not update 2024-10-23 17:55:25 +08:00
Joel
d357f359ab feat: support install failed 2024-10-23 17:52:39 +08:00
Joel
474cedf653 feat: debug info api 2024-10-23 17:19:54 +08:00
nite-knite
5d3c88a0b3 chore: bump mermaid from 10.4.0 to 10.9.3 2024-10-23 17:02:38 +08:00
Joel
ae2c76bda2 feat: install from marketplace 2024-10-23 16:42:24 +08:00
Joel
c46b5f2fd0 feat: handle install search params and hide 2024-10-23 15:26:31 +08:00
Joel
2cb7b73ee7 feat: handle import from marketplace 2024-10-23 15:00:31 +08:00
Joel
8d8d5b5235 chore: handle verified 2024-10-23 11:45:36 +08:00
Joel
15acfffd60 chore: some ui and mock data 2024-10-23 11:40:56 +08:00
Yi
18a266eac2 chore: i18n for install from GitHub section 2024-10-22 18:39:23 +08:00
Joel
7751070da8 chore: install from local i18n 2024-10-22 18:11:54 +08:00
Yi
fa8c3d0d7b Resolved merge conflicts by removing conflicting files 2024-10-22 17:58:41 +08:00
Yi
a567cff809 chore: update the install from GitHub component 2024-10-22 17:51:14 +08:00
Joel
583b0e9f97 chore: remove replicated types 2024-10-22 17:29:58 +08:00
Joel
5fddb23516 feat: install progress 2024-10-22 17:21:44 +08:00
Yi
0e52971997 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-22 16:40:50 +08:00
Yi
1387f406a3 fix: log format 2024-10-22 16:40:27 +08:00
AkaraChen
ff31f0540a style: lint 2024-10-22 15:32:58 +08:00
AkaraChen
4873e6e2a1 build: fix eslint stylistic 2024-10-22 15:32:48 +08:00
nite-knite
510ce057f7 chore: add package manager setting to vscode setting example 2024-10-22 14:18:55 +08:00
AkaraChen
0e53cc0e8c fix: eslint indent 2024-10-22 14:15:22 +08:00
Yi
0b8c896481 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-22 13:43:15 +08:00
Yi
15fe635465 chore: install package from GitHub 2024-10-22 13:43:01 +08:00
AkaraChen
f8c3189f4d build: fix eslint undef 2024-10-22 11:43:23 +08:00
AkaraChen
f215db87e3 build: fix eslint undef 2024-10-22 11:36:42 +08:00
Joel
67d02212b4 chore: pnpm 2024-10-22 11:18:30 +08:00
Joel
cff9adaf8e chore: tools ts problems 2024-10-22 11:06:28 +08:00
AkaraChen
cdd2a40086 style: minimium codemod 2024-10-22 02:24:59 +00:00
AkaraChen
024028bc52 build: sync eslint rule 2024-10-22 10:24:10 +08:00
AkaraChen
0ae085b48a build: add eslint common rule 2024-10-22 10:24:10 +08:00
AkaraChen
2094c54951 build: update eslint config antfu 2024-10-22 10:24:10 +08:00
AkaraChen
f4f11135d3 build: using eslint flat config 2024-10-22 10:24:10 +08:00
Joel
8e9d7a229d feat: scroll to view and fix action hidden 2024-10-21 18:21:45 +08:00
Joel
8f49572f85 chore: from marketplace tilte ui 2024-10-21 15:07:18 +08:00
JzoNg
5aa7696cc3 update style of action list 2024-10-21 11:34:21 +08:00
JzoNg
15dd79e822 provider detail data binding 2024-10-21 11:34:21 +08:00
JzoNg
4651ab4195 new style of provider detail 2024-10-21 11:34:21 +08:00
JzoNg
5e3160e6f6 fix title & description of tool provider 2024-10-21 11:34:21 +08:00
JzoNg
973cd126bb create & update endpoint 2024-10-21 11:34:21 +08:00
JzoNg
ebaf8766ef endpoint form 2024-10-21 11:34:21 +08:00
JzoNg
d2190e9c3a remove endpoint 2024-10-21 11:34:21 +08:00
JzoNg
37f55098fe switch endpoint service state 2024-10-21 11:34:21 +08:00
JzoNg
b1771194cc servise of endpoints 2024-10-21 11:34:21 +08:00
JzoNg
0279bd8c75 endpoint card databing 2024-10-21 11:34:21 +08:00
JzoNg
5e077e4ce8 endpoints data binding 2024-10-21 11:34:21 +08:00
JzoNg
64067e1f20 plugin detail header operations 2024-10-21 11:34:21 +08:00
JzoNg
5295c72ca1 endpoints mock data 2024-10-21 11:34:21 +08:00
JzoNg
1ecea62052 add verified tag 2024-10-21 11:34:21 +08:00
JzoNg
307af29b65 add plugin description 2024-10-21 11:34:21 +08:00
JzoNg
10190a9aa5 plugin detail header data binding 2024-10-21 11:34:21 +08:00
JzoNg
7c5c35600c plugin detail type 2024-10-21 11:34:21 +08:00
JzoNg
63b333cdb1 modify plugin detail panel 2024-10-21 11:34:21 +08:00
JzoNg
a6776190bd chore: update remix icon 2024-10-21 11:34:19 +08:00
AkaraChen
9577cbac27 build: docker use pnpm 2024-10-21 11:27:01 +08:00
AkaraChen
f6ae13abad ci: migrate to pnpm 2024-10-21 11:14:30 +08:00
AkaraChen
f3d501e7d5 fix: gen-icon script phantom deps 2024-10-21 10:43:52 +08:00
AkaraChen
2eab8fcc33 build: switch to pnpm 2024-10-21 10:43:52 +08:00
Joel
bdb81fe20d feat: choose tool sticky 2024-10-18 18:18:59 +08:00
Yi
0f60fe7f2a chore: update workspace name (truncated for long name) 2024-10-18 14:17:53 +08:00
Yi
425f624de5 chore: add plugin panel 2024-10-18 14:02:40 +08:00
Yi
b1919745e2 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-18 14:01:34 +08:00
twwu
9a242bcac9 Merge branch 'main' into feat/plugins 2024-10-18 09:59:43 +08:00
Yi
a6109a60b8 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-17 15:22:08 +08:00
Yi
28f7bbf83a chore: installation progress bar 2024-10-17 15:21:56 +08:00
Joel
cac04c5f3c refactor: chagne card to client component 2024-10-17 15:06:06 +08:00
Joel
18f5f9cc37 feat: plugin upgrade 2024-10-16 18:05:55 +08:00
Joel
1787c5c93f chore: handle tag name too long 2024-10-16 16:39:47 +08:00
Joel
f981494613 feat: plugin support emoji icon 2024-10-16 16:28:19 +08:00
Joel
fbc853af92 feat: remove config 2024-10-16 16:28:18 +08:00
StyleZhang
1a64c660ba enable marketplace 2024-10-16 15:50:18 +08:00
Joel
846555af1b fix: action buttion ui 2024-10-16 11:45:25 +08:00
Joel
bca94854f7 feat: plugin info 2024-10-16 11:30:04 +08:00
Joel
1bd70bd8bf chore: copy button 2024-10-16 11:05:51 +08:00
Joel
d1dcd39191 feat: add debug info i18n and extract common to components 2024-10-16 10:52:16 +08:00
Joel
35384bda41 chore: refactor card loading 2024-10-15 22:52:57 +08:00
Joel
89fb6eb648 chore: set hideCornerMark to optional 2024-10-15 21:45:30 +08:00
Joel
aa61a890b2 chore: change downloadCount to optional 2024-10-15 21:43:20 +08:00
Joel
31ece363c3 chore: chagne mangament attr name 2024-10-15 21:35:56 +08:00
Joel
70a5d78cc5 chore: priviege i18n 2024-10-15 21:31:06 +08:00
Joel
57f4dfdb6f feat: add permission data logic 2024-10-15 19:20:59 +08:00
Yi
aa9028a607 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-15 15:48:05 +08:00
Yi
d83f94c55c fix: set constrain for uploading packages only works in the Plugins tab 2024-10-15 15:47:54 +08:00
StyleZhang
a8c5e0b0b0 tool list item click 2024-10-15 15:13:00 +08:00
Yi
177e8cbf73 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-15 14:57:37 +08:00
Yi
23828fd15a Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-15 14:57:11 +08:00
StyleZhang
2cc37ac8e5 tool list 2024-10-15 14:57:00 +08:00
Yi
c9ee1e9ff2 feat: install difypkg ui 2024-10-15 14:56:59 +08:00
Joel
4f10f5d5f4 chore: hover show action 2024-10-15 11:57:44 +08:00
Yi
c48c84674e Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-15 11:02:45 +08:00
Yi
1e9fbbf41b fix: dynamic sub header color 2024-10-15 11:02:25 +08:00
StyleZhang
4dd144ce43 tools list 2024-10-15 10:41:10 +08:00
Yi
a387ff1c38 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-14 18:43:24 +08:00
Yi
a9e367e6de feat: use-uploader hook 2024-10-14 18:43:08 +08:00
Joel
e2fec587f8 feat: from marketplace 2024-10-14 18:35:13 +08:00
StyleZhang
39a6f0943d marketplace 2024-10-14 12:38:53 +08:00
JzoNg
684896d100 merge main 2024-10-14 10:29:52 +08:00
JzoNg
54f911f6cd endpoints 2024-10-13 10:49:55 +08:00
Joel
0e5c16d0c2 feat: view to ui and fix some ui promblem 2024-10-12 18:15:11 +08:00
Joel
b8cd6ea478 feat: support view choose 2024-10-12 17:36:35 +08:00
JzoNg
fc61fd0f50 action list 2024-10-12 17:08:45 +08:00
JzoNg
2fbfc988c4 plugin panel detail 2024-10-12 16:37:57 +08:00
JzoNg
99f5fea001 plugin detail panel header 2024-10-12 16:37:57 +08:00
StyleZhang
ecd2a1be9f marketplace 2024-10-12 16:34:18 +08:00
Joel
49ee9ca5f1 feat: tool item support action 2024-10-12 16:04:16 +08:00
Joel
6d0eef12b1 feat: split tools data to out and add demo 2024-10-12 14:30:46 +08:00
StyleZhang
c1e0a939b0 marketplace 2024-10-12 12:46:49 +08:00
JzoNg
060a894bd1 interaction of plugin detail panel 2024-10-12 12:36:29 +08:00
JzoNg
c75e02b5b2 update provider card 2024-10-12 12:36:29 +08:00
StyleZhang
fcf43ee845 plugin page context 2024-10-12 11:33:12 +08:00
StyleZhang
466f61d044 relocate file 2024-10-12 11:05:03 +08:00
StyleZhang
27ae74af50 hook 2024-10-12 11:03:00 +08:00
Joel
8dd941e3d2 chore: instal plug add tag 2024-10-11 18:18:32 +08:00
Joel
dec4bf6b98 fix: install modal item server 2024-10-11 18:06:23 +08:00
Joel
e2c33fc40f fix: plugin item i18n 2024-10-11 18:05:45 +08:00
Yi
c74e59d1f4 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-11 17:28:27 +08:00
Yi
1fcb902715 feat: add cards to "install from marketplace" 2024-10-11 17:25:33 +08:00
JzoNg
c08f98218c hide search in other pages 2024-10-11 17:13:28 +08:00
Yi
c6377f6e38 fix: naming styles 2024-10-11 16:29:07 +08:00
Yi
3cb0a5bd68 Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-11 16:28:04 +08:00
Yi
95777d23e0 fix: naming styles 2024-10-11 16:27:31 +08:00
JzoNg
e7dc16fd08 provider card 2024-10-11 16:21:19 +08:00
JzoNg
495dec143c unconfigured provider 2024-10-11 16:21:19 +08:00
JzoNg
4cc6dfa232 new style of provider card 2024-10-11 16:21:18 +08:00
JzoNg
d1452d4af4 no provider installed 2024-10-11 16:21:18 +08:00
JzoNg
d68ca56b3a system default model 2024-10-11 16:21:18 +08:00
JzoNg
49856d8d17 setting content header & close button 2024-10-11 16:21:18 +08:00
JzoNg
902de72cc0 new style of settings 2024-10-11 16:21:18 +08:00
StyleZhang
76f6b8d104 marketplace 2024-10-11 16:15:24 +08:00
StyleZhang
f111e605c4 marketplace 2024-10-11 15:27:14 +08:00
Joel
b358ed3a5b fix: init workflow image crash 2024-10-11 14:31:14 +08:00
Joel
88dbf639e0 chore: enchance locale props 2024-10-11 14:24:43 +08:00
Joel
aa8b525b48 fix: icon tsx to router problem 2024-10-11 14:10:24 +08:00
Yi
c990bc61db feat: install plugins (partial) 2024-10-11 12:39:27 +08:00
Joel
6d7588f236 chore: fix ui 2024-10-10 17:53:13 +08:00
Joel
8257c7bf02 chore: remove useless data 2024-10-10 17:49:23 +08:00
Joel
946068967b feat: finish card components 2024-10-10 17:47:04 +08:00
Joel
19f5684960 feat: add label and fix some ui problem 2024-10-10 11:29:11 +08:00
Joel
6d62840aff chore: split card component 2024-10-10 10:40:26 +08:00
Joel
ab868ac979 fix: error igm 2024-10-10 10:25:25 +08:00
Joel
1d74e693ea chore: fix imge name 2024-10-10 10:22:18 +08:00
Joel
fa43d4202f feat: plugin item 2024-10-09 18:36:15 +08:00
Joel
6b29860788 feat: add installed 2024-10-09 18:12:14 +08:00
Joel
36800eeaba feat: base card component 2024-10-09 17:51:54 +08:00
Yi
67acd174ac add different styles to plugins and discover 2024-10-09 15:55:33 +08:00
StyleZhang
b5edc64b2a plugin type switch 2024-10-09 15:06:09 +08:00
Yi
d00b2724cc Merge branch 'feat/plugins' of github.com:langgenius/dify into feat/plugins 2024-10-09 12:53:56 +08:00
Yi
43f87c0b86 make the drop plugin only appears when the user selects "plugins" 2024-10-09 12:53:43 +08:00
Joel
7a43f48c95 chore: add test page 2024-10-09 11:35:16 +08:00
StyleZhang
58a913b09d marketplace 2024-10-08 17:58:05 +08:00
Joel
cd03795f2c chore: add endpoint types 2024-10-08 15:44:52 +08:00
Joel
36f8b5711d feat: plugin types 2024-09-30 15:29:53 +08:00
Joel
f9c48e9ea9 fix: eslint to find top dir 2024-09-29 18:27:36 +08:00
JzoNg
3b48f8c98e Merge branch 'main' into tp 2024-09-27 16:47:57 +08:00
JzoNg
cef1010cb5 style update 2024-09-27 16:47:01 +08:00
Joel
cb4875a3a7 chore: split the common tailwind config 2024-09-26 15:06:36 +08:00
StyleZhang
bbca708832 add marketplace card 2024-09-24 11:18:34 +08:00
JzoNg
05aec43ee3 Merge branch 'main' into tp 2024-09-23 11:39:46 +08:00
Yi
e8127756e0 Merge branch 'main' of github.com:langgenius/dify into feat/plugins 2024-09-18 20:57:52 +08:00
Yi
792595a46f update page header 2024-09-18 18:32:33 +08:00
Yi
d7d7281c93 feat: plugin homepage 2024-09-16 18:58:39 +08:00
Yi
21193c2fbf update the plugins page 2024-09-14 17:09:25 +08:00
429 changed files with 26880 additions and 1648 deletions

View File

@ -1,11 +1,12 @@
#!/bin/bash
cd web && npm install
npm add -g pnpm@9.12.2
cd web && pnpm install
pipx install poetry
echo 'alias start-api="cd /workspaces/dify/api && poetry run python -m flask run --host 0.0.0.0 --port=5001 --debug"' >> ~/.bashrc
echo 'alias start-worker="cd /workspaces/dify/api && poetry run python -m celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion"' >> ~/.bashrc
echo 'alias start-web="cd /workspaces/dify/web && npm run dev"' >> ~/.bashrc
echo 'alias start-web="cd /workspaces/dify/web && pnpm dev"' >> ~/.bashrc
echo 'alias start-containers="cd /workspaces/dify/docker && docker-compose -f docker-compose.middleware.yaml -p dify up -d"' >> ~/.bashrc
source /home/vscode/.bashrc
source /home/vscode/.bashrc

View File

@ -76,16 +76,16 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
with:
node-version: 20
cache: yarn
cache: pnpm
cache-dependency-path: ./web/package.json
- name: Web dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Web style check
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn run lint
run: pnpm run lint
superlinter:

View File

@ -32,10 +32,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: ''
cache-dependency-path: 'yarn.lock'
cache-dependency-path: 'pnpm-lock.yaml'
- name: Install Dependencies
run: yarn install
run: pnpm install
- name: Test
run: yarn test
run: pnpm test

View File

@ -38,11 +38,11 @@ jobs:
- name: Install dependencies
if: env.FILES_CHANGED == 'true'
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Run npm script
if: env.FILES_CHANGED == 'true'
run: npm run auto-gen-i18n
run: pnpm run auto-gen-i18n
- name: Create Pull Request
if: env.FILES_CHANGED == 'true'

View File

@ -34,13 +34,13 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
with:
node-version: 20
cache: yarn
cache: pnpm
cache-dependency-path: ./web/package.json
- name: Install dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn install --frozen-lockfile
run: pnpm install --frozen-lockfile
- name: Run tests
if: steps.changed-files.outputs.any_changed == 'true'
run: yarn test
run: pnpm test

5
.gitignore vendored
View File

@ -189,4 +189,7 @@ pyrightconfig.json
api/.vscode
.idea/
.vscode
.vscode
# pnpm
/.pnpm-store

View File

@ -38,7 +38,6 @@ class AliYuqueDescribeDocumentContentTool(AliYuqueTool, BuiltinTool):
book_id = index_page.get("data", {}).get("book", {}).get("id")
if not book_id:
raise Exception(f"can not parse book_id from {index_page}")
new_params["book_id"] = book_id
new_params["id"] = doc_id
data = self.request("GET", token, new_params, "/api/v2/repos/{book_id}/docs/{id}")

View File

@ -1,5 +0,0 @@
{
"presets": [
"@babel/preset-env"
]
}

View File

@ -10,6 +10,8 @@ NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api
# console or api domain.
# example: http://udify.app/api
NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api
# The URL for MARKETPLACE
NEXT_PUBLIC_MARKETPLACE_API_PREFIX=http://localhost:5002/api
# SENTRY
NEXT_PUBLIC_SENTRY_DSN=

View File

@ -1,7 +0,0 @@
/**/node_modules/*
node_modules/
dist/
build/
out/
.next/

View File

@ -1,31 +0,0 @@
{
"extends": [
"next",
"@antfu",
"plugin:storybook/recommended"
],
"rules": {
"@typescript-eslint/consistent-type-definitions": [
"error",
"type"
],
"@typescript-eslint/no-var-requires": "off",
"no-console": "off",
"indent": "off",
"@typescript-eslint/indent": [
"error",
2,
{
"SwitchCase": 1,
"flatTernaryExpressions": false,
"ignoredNodes": [
"PropertyDefinition[decorators]",
"TSUnionType",
"FunctionExpression[params]:has(Identifier[decorators])"
]
}
],
"react-hooks/exhaustive-deps": "warn",
"react/display-name": "warn"
}
}

9
web/.gitignore vendored
View File

@ -44,10 +44,9 @@ package-lock.json
.pnp.cjs
.pnp.loader.mjs
.yarn/
.yarnrc.yml
# pmpm
pnpm-lock.yaml
.favorites.json
*storybook.log
# storybook
/storybook-static
*storybook.log

View File

@ -1,6 +1,3 @@
#!/usr/bin/env bash
. "$(dirname -- "$0")/_/husky.sh"
# get the list of modified files
files=$(git diff --cached --name-only)
@ -50,7 +47,7 @@ fi
if $web_modified; then
echo "Running ESLint on web module"
cd ./web || exit 1
npx lint-staged
lint-staged
echo "Running unit tests check"
modified_files=$(git diff --cached --name-only -- utils | grep -v '\.spec\.ts$' || true)
@ -63,7 +60,7 @@ if $web_modified; then
# check if the test file exists
if [ -f "../$test_file" ]; then
echo "Detected changes in $file, running corresponding unit tests..."
npm run test "../$test_file"
pnpm run test "../$test_file"
if [ $? -ne 0 ]; then
echo "Unit tests failed. Please fix the errors before committing."

View File

@ -1,19 +1,19 @@
import type { StorybookConfig } from '@storybook/nextjs'
const config: StorybookConfig = {
// stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
stories: ['../app/components/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/nextjs',
options: {},
},
staticDirs: ['../public'],
// stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
stories: ['../app/components/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/nextjs',
options: {},
},
staticDirs: ['../public'],
}
export default config

View File

@ -1,6 +1,6 @@
import React from 'react'
import type { Preview } from '@storybook/react'
import { withThemeByDataAttribute } from '@storybook/addon-themes';
import { withThemeByDataAttribute } from '@storybook/addon-themes'
import I18nServer from '../app/components/i18n-server'
import '../app/styles/globals.css'
@ -8,30 +8,30 @@ import '../app/styles/markdown.scss'
import './storybook.css'
export const decorators = [
withThemeByDataAttribute({
themes: {
light: 'light',
dark: 'dark',
},
defaultTheme: 'light',
attributeName: 'data-theme',
}),
Story => {
return <I18nServer>
<Story />
</I18nServer>
}
];
withThemeByDataAttribute({
themes: {
light: 'light',
dark: 'dark',
},
defaultTheme: 'light',
attributeName: 'data-theme',
}),
(Story) => {
return <I18nServer>
<Story />
</I18nServer>
},
]
const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
}
export default preview

View File

@ -21,5 +21,6 @@
"editor.defaultFormatter": "vscode.json-language-features"
},
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
"typescript.enablePromptUseWorkspaceTsdk": true,
"npm.packageManager": "pnpm"
}

View File

@ -6,6 +6,9 @@ LABEL maintainer="takatost@gmail.com"
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk add --no-cache tzdata
RUN npm install -g pnpm@9.12.2
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# install packages
@ -14,12 +17,12 @@ FROM base AS packages
WORKDIR /app/web
COPY package.json .
COPY yarn.lock .
COPY pnpm-lock.yaml .
# if you located in China, you can use taobao registry to speed up
# RUN yarn install --frozen-lockfile --registry https://registry.npmmirror.com/
# RUN pnpm install --frozen-lockfile --registry https://registry.npmmirror.com/
RUN yarn install --frozen-lockfile
RUN pnpm install --frozen-lockfile
# build resources
FROM base AS builder
@ -27,7 +30,7 @@ WORKDIR /app/web
COPY --from=packages /app/web/ .
COPY . .
RUN yarn build
RUN pnpm build
# production stage
@ -57,8 +60,7 @@ COPY docker/entrypoint.sh ./entrypoint.sh
# global runtime packages
RUN yarn global add pm2 \
&& yarn cache clean \
RUN pnpm add -g pm2 \
&& mkdir /.pm2 \
&& chown -R 1001:0 /.pm2 /app/web \
&& chmod -R g=u /.pm2 /app/web

View File

@ -6,14 +6,12 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next
### Run by source code
To start the web frontend service, you will need [Node.js v18.x (LTS)](https://nodejs.org/en) and [NPM version 8.x.x](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com/).
To start the web frontend service, you will need [Node.js v18.x (LTS)](https://nodejs.org/en) and [pnpm version 9.12.2](https://pnpm.io).
First, install the dependencies:
```bash
npm install
# or
yarn install --frozen-lockfile
pnpm install
```
Then, configure the environment variables. Create a file named `.env.local` in the current directory and copy the contents from `.env.example`. Modify the values of these environment variables according to your requirements:
@ -43,9 +41,7 @@ NEXT_PUBLIC_SENTRY_DSN=
Finally, run the development server:
```bash
npm run dev
# or
yarn dev
pnpm run dev
```
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
@ -59,19 +55,19 @@ You can start editing the file under folder `app`. The page auto-updates as you
First, build the app for production:
```bash
npm run build
pnpm run build
```
Then, start the server:
```bash
npm run start
pnpm run start
```
If you want to customize the host and port:
```bash
npm run start --port=3001 --host=0.0.0.0
pnpm run start --port=3001 --host=0.0.0.0
```
## Storybook
@ -81,7 +77,7 @@ This project uses [Storybook](https://storybook.js.org/) for UI component develo
To start the storybook server, run:
```bash
yarn storybook
pnpm storybook
```
Open [http://localhost:6006](http://localhost:6006) with your browser to see the result.
@ -99,7 +95,7 @@ You can create a test file with a suffix of `.spec` beside the file that to be t
Run test:
```bash
npm run test
pnpm run test
```
If you are not familiar with writing tests, here is some code to refer to:

View File

@ -2,7 +2,7 @@ import React from 'react'
import Main from '@/app/components/app/log-annotation'
import { PageType } from '@/app/components/base/features/new-feature-panel/annotation-reply/type'
export type IProps = {
export interface IProps {
params: { appId: string }
}

View File

@ -1,5 +1,5 @@
import React from 'react'
import { type Locale } from '@/i18n'
import type { Locale } from '@/i18n'
import DevelopMain from '@/app/components/develop'
export type IDevelopProps = {

View File

@ -4,7 +4,7 @@ import React from 'react'
import cn from '@/utils/classnames'
import Input from '@/app/components/base/input'
type Props = {
interface Props {
className?: string
label: string
labelClassName?: string

View File

@ -8,12 +8,11 @@ import { useBoolean } from 'ahooks'
import {
Cog8ToothIcon,
// CommandLineIcon,
Squares2X2Icon,
// eslint-disable-next-line sort-imports
PuzzlePieceIcon,
DocumentTextIcon,
PaperClipIcon,
PuzzlePieceIcon,
QuestionMarkCircleIcon,
Squares2X2Icon,
} from '@heroicons/react/24/outline'
import {
Cog8ToothIcon as Cog8ToothSolidIcon,

View File

@ -0,0 +1,18 @@
import PluginPage from '@/app/components/plugins/plugin-page'
import PluginsPanel from '@/app/components/plugins/plugin-page/plugins-panel'
import Marketplace from '@/app/components/plugins/marketplace'
const PluginList = async () => {
return (
<PluginPage
plugins={<PluginsPanel />}
marketplace={<Marketplace />}
/>
)
}
export const metadata = {
title: 'Plugins - Dify',
}
export default PluginList

View File

@ -0,0 +1,14 @@
'use server'
import { revalidatePath } from 'next/cache'
// Server Actions
export async function handleDelete() {
// revalidatePath only invalidates the cache when the included path is next visited.
revalidatePath('/')
}
export async function fetchPluginDetail(org: string, name: string) {
// Fetch plugin detail TODO
return { org, name }
}

View File

@ -0,0 +1,74 @@
import { handleDelete } from './actions'
import Card from '@/app/components/plugins/card'
import { customTool, extensionDallE, modelGPT4, toolNotion } from '@/app/components/plugins/card/card-mock'
import PluginItem from '@/app/components/plugins/plugin-item'
import CardMoreInfo from '@/app/components/plugins/card/card-more-info'
import ProviderCard from '@/app/components/plugins/provider-card'
import Badge from '@/app/components/base/badge'
const PluginList = async () => {
const pluginList = [toolNotion, extensionDallE, modelGPT4, customTool]
return (
<div className='pb-3 bg-white'>
<div className='mx-3 '>
<h2 className='my-3'>Dify Plugin list</h2>
<div className='grid grid-cols-2 gap-3'>
{pluginList.map((plugin, index) => (
<PluginItem
key={index}
payload={plugin as any}
onDelete={handleDelete}
/>
))}
</div>
<h2 className='my-3'>Install Plugin / Package under bundle</h2>
<div className='w-[512px] rounded-2xl bg-background-section-burn p-2'>
<Card
payload={toolNotion as any}
descriptionLineRows={1}
titleLeft={
<Badge className='ml-1' text={toolNotion.version} />
}
/>
</div>
<h3 className='my-1'>Installed</h3>
<div className='w-[512px] rounded-2xl bg-background-section-burn p-2'>
<Card
payload={toolNotion as any}
descriptionLineRows={1}
installed
/>
</div>
<h3 className='my-1'>Install model provide</h3>
<div className='grid grid-cols-2 gap-3'>
{pluginList.map((plugin, index) => (
<ProviderCard key={index} payload={plugin as any} />
))}
</div>
<div className='my-3 h-[px] bg-gray-50'></div>
<h2 className='my-3'>Marketplace Plugin list</h2>
<div className='grid grid-cols-4 gap-3'>
{pluginList.map((plugin, index) => (
<Card
key={index}
payload={plugin as any}
footer={
<CardMoreInfo downloadCount={index % 2 === 0 ? 1234 : 6} tags={index % 2 === 0 ? ['Search', 'Tag that has very very long name', 'Productivity', 'Tag2'] : []} />
}
/>
))}
</div>
</div>
</div>
)
}
export const metadata = {
title: 'Plugins - Card',
}
export default PluginList

View File

@ -0,0 +1,20 @@
'use client'
import { useBoolean } from 'ahooks'
import UpdatePlugin from '@/app/components/plugins/update-plugin'
const Page = () => {
const [isShowUpdateModal, {
setTrue: showUpdateModal,
setFalse: hideUpdateModal,
}] = useBoolean(false)
return (
<div>
<div onClick={showUpdateModal}>Show Upgrade</div>
{isShowUpdateModal && (
<UpdatePlugin onHide={hideUpdateModal} />
)}
</div>
)
}
export default Page

View File

@ -0,0 +1,39 @@
'use client'
import { useEffect, useState } from 'react'
import AllTools from '@/app/components/workflow/block-selector/all-tools'
import {
fetchAllBuiltInTools,
fetchAllCustomTools,
fetchAllWorkflowTools,
} from '@/service/tools'
import type { ToolWithProvider } from '@/app/components/workflow/types'
const ToolsPicker = () => {
const [buildInTools, setBuildInTools] = useState<ToolWithProvider[]>([])
const [customTools, setCustomTools] = useState<ToolWithProvider[]>([])
const [workflowTools, setWorkflowTools] = useState<ToolWithProvider[]>([])
useEffect(() => {
(async () => {
const buildInTools = await fetchAllBuiltInTools()
const customTools = await fetchAllCustomTools()
const workflowTools = await fetchAllWorkflowTools()
setBuildInTools(buildInTools)
setCustomTools(customTools)
setWorkflowTools(workflowTools)
})()
})
return (
<div className="relative mt-5 mx-auto w-[320px] bg-white">
<AllTools
searchText=""
onSelect={() => { }}
buildInTools={buildInTools}
customTools={customTools}
workflowTools={workflowTools}
/>
</div>
)
}
export default ToolsPicker

View File

@ -1,8 +1,7 @@
'use client'
import { useTranslation } from 'react-i18next'
import { Fragment } from 'react'
import { useRouter } from 'next/navigation'
import { Menu, Transition } from '@headlessui/react'
import { Menu, MenuButton, MenuItem, MenuItems, Transition } from '@headlessui/react'
import Avatar from '@/app/components/base/avatar'
import { logout } from '@/service/common'
import { useAppContext } from '@/context/app-context'
@ -35,7 +34,7 @@ export default function AppSelector() {
({ open }) => (
<>
<div>
<Menu.Button
<MenuButton
className={`
inline-flex items-center
rounded-[20px] p-1x text-sm
@ -45,10 +44,9 @@ export default function AppSelector() {
`}
>
<Avatar name={userProfile.name} size={32} />
</Menu.Button>
</MenuButton>
</div>
<Transition
as={Fragment}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
@ -56,14 +54,14 @@ export default function AppSelector() {
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items
<MenuItems
className="
absolute -right-2 -top-1 w-60 max-w-80
divide-y divide-gray-100 origin-top-right rounded-lg bg-white
shadow-lg
"
>
<Menu.Item>
<MenuItem>
<div className='p-1'>
<div className='flex flex-nowrap items-center px-3 py-2'>
<div className='grow'>
@ -73,8 +71,8 @@ export default function AppSelector() {
<Avatar name={userProfile.name} size={32} />
</div>
</div>
</Menu.Item>
<Menu.Item>
</MenuItem>
<MenuItem>
<div className='p-1' onClick={() => handleLogout()}>
<div
className='flex items-center justify-start h-9 px-3 rounded-lg cursor-pointer group hover:bg-gray-50'
@ -83,8 +81,8 @@ export default function AppSelector() {
<div className='font-normal text-[14px] text-gray-700'>{t('common.userProfile.logout')}</div>
</div>
</div>
</Menu.Item>
</Menu.Items>
</MenuItem>
</MenuItems>
</Transition>
</>
)

View File

@ -6,11 +6,11 @@ import useSWR from 'swr'
import Input from '@/app/components/base/input'
import { fetchAnnotationsCount } from '@/service/log'
export type QueryParam = {
export interface QueryParam {
keyword?: string
}
type IFilterProps = {
interface IFilterProps {
appId: string
queryParams: QueryParam
setQueryParams: (v: QueryParam) => void

View File

@ -1,6 +1,6 @@
'use client'
import type { FC } from 'react'
import React, { Fragment, useEffect, useState } from 'react'
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
RiAddLine,
@ -9,7 +9,7 @@ import { useContext } from 'use-context-selector'
import {
useCSVDownloader,
} from 'react-papaparse'
import { Menu, Transition } from '@headlessui/react'
import { Menu, MenuButton, MenuItems, Transition } from '@headlessui/react'
import Button from '../../../base/button'
import AddAnnotationModal from '../add-annotation-modal'
import type { AnnotationItemBasic } from '../type'
@ -87,13 +87,12 @@ const HeaderOptions: FC<Props> = ({
<span className={s.actionName}>{t('appAnnotation.table.header.bulkImport')}</span>
</button>
<Menu as="div" className="relative w-full h-full">
<Menu.Button className={s.actionItem}>
<MenuButton className={s.actionItem}>
<FileDownload02 className={s.actionItemIcon} />
<span className={s.actionName}>{t('appAnnotation.table.header.bulkExport')}</span>
<ChevronRight className='shrink-0 w-[14px] h-[14px] text-gray-500' />
</Menu.Button>
</MenuButton>
<Transition
as={Fragment}
enter="transition ease-out duration-100"
enterFrom="transform opacity-0 scale-95"
enterTo="transform opacity-100 scale-100"
@ -101,7 +100,7 @@ const HeaderOptions: FC<Props> = ({
leaveFrom="transform opacity-100 scale-100"
leaveTo="transform opacity-0 scale-95"
>
<Menu.Items
<MenuItems
className={cn(
`
absolute top-[1px] py-1 min-w-[100px] z-10 bg-white border-[0.5px] border-gray-200
@ -126,7 +125,7 @@ const HeaderOptions: FC<Props> = ({
<button disabled={annotationUnavailable} className={cn(s.actionItem, '!border-0')} onClick={JSONLOutput}>
<span className={s.actionName}>JSONL</span>
</button>
</Menu.Items>
</MenuItems>
</Transition>
</Menu>
</div>

View File

@ -27,7 +27,7 @@ import AnnotationFullModal from '@/app/components/billing/annotation-full/modal'
import { Settings04 } from '@/app/components/base/icons/src/vender/line/general'
import type { App } from '@/types/app'
type Props = {
interface Props {
appDetail: App
}

View File

@ -9,7 +9,7 @@ import RemoveAnnotationConfirmModal from './remove-annotation-confirm-modal'
import cn from '@/utils/classnames'
import useTimestamp from '@/hooks/use-timestamp'
type Props = {
interface Props {
list: AnnotationItem[]
onRemove: (id: string) => void
onView: (item: AnnotationItem) => void

View File

@ -3,7 +3,7 @@ import type { FC, ReactNode } from 'react'
import React from 'react'
import cn from '@/utils/classnames'
export type IFeaturePanelProps = {
export interface IFeaturePanelProps {
className?: string
headerIcon?: ReactNode
title: ReactNode

View File

@ -9,7 +9,7 @@ import { MessageClockCircle } from '@/app/components/base/icons/src/vender/solid
import I18n from '@/context/i18n'
import { LanguagesSupported } from '@/i18n/language'
type Props = {
interface Props {
showWarning: boolean
onShowEditModal: () => void
}

View File

@ -9,7 +9,7 @@ import ConfirmAddVar from './confirm-add-var'
import s from './style.module.css'
import PromptEditorHeightResizeWrap from './prompt-editor-height-resize-wrap'
import cn from '@/utils/classnames'
import { type PromptVariable } from '@/models/debug'
import type { PromptVariable } from '@/models/debug'
import Tooltip from '@/app/components/base/tooltip'
import type { CompletionParams } from '@/types/app'
import { AppType } from '@/types/app'

View File

@ -3,7 +3,7 @@ import type { FC } from 'react'
import React from 'react'
import cn from '@/utils/classnames'
type Props = {
interface Props {
className?: string
title: string
children: JSX.Element

View File

@ -23,7 +23,7 @@ import { DEFAULT_VALUE_MAX_LEN } from '@/config'
const TEXT_MAX_LENGTH = 256
export type IConfigModalProps = {
export interface IConfigModalProps {
isCreate?: boolean
payload?: InputVar
isShow: boolean

View File

@ -3,7 +3,7 @@ import type { FC } from 'react'
import React, { useEffect } from 'react'
import Input from '@/app/components/base/input'
export type IConfigStringProps = {
export interface IConfigStringProps {
value: number | undefined
maxLength: number
modelId: string
@ -28,7 +28,7 @@ const ConfigString: FC<IConfigStringProps> = ({
min={1}
value={value || ''}
onChange={(e) => {
let value = parseInt(e.target.value, 10)
let value = Number.parseInt(e.target.value, 10)
if (value > maxLength)
value = maxLength

View File

@ -3,7 +3,6 @@ import type { FC } from 'react'
import React, { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useBoolean } from 'ahooks'
import type { Timeout } from 'ahooks/lib/useRequest/src/types'
import { useContext } from 'use-context-selector'
import produce from 'immer'
import {
@ -34,7 +33,7 @@ import { InputVarType } from '@/app/components/workflow/types'
export const ADD_EXTERNAL_DATA_TOOL = 'ADD_EXTERNAL_DATA_TOOL'
type ExternalDataToolParams = {
interface ExternalDataToolParams {
key: string
type: string
index: number
@ -44,13 +43,13 @@ type ExternalDataToolParams = {
icon_background?: string
}
export type IConfigVarProps = {
export interface IConfigVarProps {
promptVariables: PromptVariable[]
readonly?: boolean
onPromptVariablesChange?: (promptVariables: PromptVariable[]) => void
}
let conflictTimer: Timeout
let conflictTimer: number
const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVariablesChange }) => {
const { t } = useTranslation()
@ -107,7 +106,7 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
onPromptVariablesChange?.(newPromptVariables)
}
const updatePromptKey = (index: number, newKey: string) => {
clearTimeout(conflictTimer)
window.clearTimeout(conflictTimer)
const { isValid, errorKey, errorMessageKey } = checkKeys([newKey], true)
if (!isValid) {
Toast.notify({
@ -127,7 +126,7 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
return item
})
conflictTimer = setTimeout(() => {
conflictTimer = window.setTimeout(() => {
const isKeyExists = promptVariables.some(item => item.key?.trim() === newKey.trim())
if (isKeyExists) {
Toast.notify({

View File

@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next'
import cn from '@/utils/classnames'
import type { InputVarType } from '@/app/components/workflow/types'
import InputVarTypeIcon from '@/app/components/workflow/nodes/_base/components/input-var-type-icon'
export type ISelectTypeItemProps = {
export interface ISelectTypeItemProps {
type: InputVarType
selected: boolean
onClick: () => void

View File

@ -106,23 +106,22 @@ const SettingBuiltInTool: FC<Props> = ({
</div>
{infoSchemas.length > 0 && (
<div className='mt-6'>
<div className='flex items-center mb-4 leading-[18px] text-xs font-semibold text-gray-500 uppercase'>
<div className='mr-3'>{t('tools.setBuiltInTools.parameters')}</div>
<div className='grow w-0 h-px bg-[#f3f4f6]'></div>
<div className='my-2'>
<div className='pt-3 text-text-secondary system-sm-semibold-uppercase'>
{t('tools.setBuiltInTools.parameters')}
</div>
<div className='space-y-4'>
<div className='py-2 space-y-3'>
{infoSchemas.map((item: any, index) => (
<div key={index}>
<div className='flex items-center space-x-2 leading-[18px]'>
<div className='text-[13px] font-semibold text-gray-900'>{item.label[language]}</div>
<div className='text-xs font-medium text-gray-500'>{item.type === 'number-input' ? t('tools.setBuiltInTools.number') : t('tools.setBuiltInTools.string')}</div>
<div key={index} className='py-1'>
<div className='flex items-center gap-2'>
<div className='text-text-secondary code-sm-semibold'>{item.label[language]}</div>
<div className='text-text-tertiary system-xs-regular'>{item.type === 'number-input' ? t('tools.setBuiltInTools.number') : t('tools.setBuiltInTools.string')}</div>
{item.required && (
<div className='text-xs font-medium text-[#EC4A0A]'>{t('tools.setBuiltInTools.required')}</div>
<div className='text-text-warning-secondary system-xs-medium'>{t('tools.setBuiltInTools.required')}</div>
)}
</div>
{item.human_description && (
<div className='mt-1 leading-[18px] text-xs font-normal text-gray-600'>
<div className='mt-0.5 text-text-tertiary system-xs-regular'>
{item.human_description?.[language]}
</div>
)}
@ -192,9 +191,9 @@ const SettingBuiltInTool: FC<Props> = ({
</>)}
</div>
)}
panelClassName='mt-[65px] !w-[405px]'
maxWidthClassName='!max-w-[405px]'
height='calc(100vh - 65px)'
panelClassName='mt-[64px] mb-2 !w-[420px]'
maxWidthClassName='!max-w-[420px]'
height='calc(100vh - 64px)'
headerClassName='!border-b-black/5'
body={
<div className='h-full pt-3'>
@ -203,7 +202,7 @@ const SettingBuiltInTool: FC<Props> = ({
<Loading type='app' />
</div>
: (<div className='flex flex-col h-full'>
<div className='grow h-0 overflow-y-auto px-6'>
<div className='grow h-0 overflow-y-auto px-4'>
{isInfoActive ? infoUI : settingUI}
</div>
{!readonly && !isInfoActive && (

View File

@ -34,7 +34,7 @@ import { LoveMessage } from '@/app/components/base/icons/src/vender/features'
import type { AutomaticRes } from '@/service/debug'
import { Generator } from '@/app/components/base/icons/src/vender/other'
export type IGetAutomaticResProps = {
export interface IGetAutomaticResProps {
mode: AppType
model: Model
isShow: boolean

View File

@ -11,7 +11,7 @@ import AgentTools from './agent/agent-tools'
import ConfigContext from '@/context/debug-configuration'
import ConfigPrompt from '@/app/components/app/configuration/config-prompt'
import ConfigVar from '@/app/components/app/configuration/config-var'
import { type ModelConfig, type PromptVariable } from '@/models/debug'
import type { ModelConfig, PromptVariable } from '@/models/debug'
import type { AppType } from '@/types/app'
import { ModelModeType } from '@/types/app'

View File

@ -25,7 +25,7 @@ import { useSelectedDatasetsMode } from '@/app/components/workflow/nodes/knowled
import Switch from '@/app/components/base/switch'
import Toast from '@/app/components/base/toast'
type Props = {
interface Props {
datasetConfigs: DatasetConfigs
onChange: (configs: DatasetConfigs, isRetrievalModeChange?: boolean) => void
isInWorkflow?: boolean

View File

@ -18,7 +18,7 @@ import {
getMultipleRetrievalConfig,
} from '@/app/components/workflow/nodes/knowledge-retrieval/utils'
type ParamsConfigProps = {
interface ParamsConfigProps {
disabled?: boolean
selectedDatasets: DataSet[]
}

View File

@ -33,7 +33,7 @@ import { ModelTypeEnum } from '@/app/components/header/account-setting/model-pro
import { fetchMembers } from '@/service/common'
import type { Member } from '@/models/common'
type SettingsModalProps = {
interface SettingsModalProps {
currentDataset: DataSet
onCancel: () => void
onSave: (newDataset: DataSet) => void

View File

@ -30,7 +30,7 @@ import { ModelFeatureEnum } from '@/app/components/header/account-setting/model-
import { useFeatures } from '@/app/components/base/features/hooks'
import type { InputForm } from '@/app/components/base/chat/chat/type'
type ChatItemProps = {
interface ChatItemProps {
modelAndParameter: ModelAndParameter
}
const ChatItem: FC<ChatItemProps> = ({

View File

@ -15,7 +15,7 @@ import { useEventEmitterContextContext } from '@/context/event-emitter'
import { useProviderContext } from '@/context/provider-context'
import { useFeatures } from '@/app/components/base/features/hooks'
type TextGenerationItemProps = {
interface TextGenerationItemProps {
modelAndParameter: ModelAndParameter
}
const TextGenerationItem: FC<TextGenerationItemProps> = ({

View File

@ -27,10 +27,10 @@ import { useFeatures } from '@/app/components/base/features/hooks'
import { getLastAnswer } from '@/app/components/base/chat/utils'
import type { InputForm } from '@/app/components/base/chat/chat/type'
type DebugWithSingleModelProps = {
interface DebugWithSingleModelProps {
checkCanSend?: () => boolean
}
export type DebugWithSingleModelRefType = {
export interface DebugWithSingleModelRefType {
handleRestart: () => void
}
const DebugWithSingleModel = forwardRef<DebugWithSingleModelRefType, DebugWithSingleModelProps>(({

View File

@ -48,7 +48,7 @@ import PromptLogModal from '@/app/components/base/prompt-log-modal'
import { useStore as useAppStore } from '@/app/components/app/store'
import { useFeatures, useFeaturesStore } from '@/app/components/base/features/hooks'
type IDebug = {
interface IDebug {
isAPIKeySet: boolean
onSetting: () => void
inputs: Inputs

View File

@ -59,7 +59,7 @@ import {
useTextGenerationCurrentProviderAndModelAndModelList,
} from '@/app/components/header/account-setting/model-provider-page/hooks'
import { fetchCollectionList } from '@/service/tools'
import { type Collection } from '@/app/components/tools/types'
import type { Collection } from '@/app/components/tools/types'
import { useStore as useAppStore } from '@/app/components/app/store'
import {
getMultipleRetrievalConfig,
@ -72,7 +72,7 @@ import { SupportUploadFileTypes } from '@/app/components/workflow/types'
import NewFeaturePanel from '@/app/components/base/features/new-feature-panel'
import { fetchFileUploadConfig } from '@/service/common'
type PublishConfig = {
interface PublishConfig {
modelConfig: ModelConfig
completionParams: FormValue
}
@ -156,7 +156,6 @@ const Configuration: FC = () => {
const setCompletionParams = (value: FormValue) => {
const params = { ...value }
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if ((!params.stop || params.stop.length === 0) && (modeModeTypeRef.current === ModelModeType.completion)) {
params.stop = getTempStop()
setTempStop([])
@ -351,7 +350,6 @@ const Configuration: FC = () => {
const [canReturnToSimpleMode, setCanReturnToSimpleMode] = useState(true)
const setPromptMode = async (mode: PromptMode) => {
if (mode === PromptMode.advanced) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
await migrateToDefaultPrompt()
setCanReturnToSimpleMode(true)
}
@ -589,7 +587,6 @@ const Configuration: FC = () => {
annotation_reply: modelConfig.annotation_reply,
external_data_tools: modelConfig.external_data_tools,
dataSets: datasets || [],
// eslint-disable-next-line multiline-ternary
agentConfig: res.mode === 'agent-chat' ? {
max_iteration: DEFAULT_AGENT_SETTING.max_iteration,
...modelConfig.agent_mode,

View File

@ -23,7 +23,7 @@ import { DEFAULT_VALUE_MAX_LEN } from '@/config'
import { useStore as useAppStore } from '@/app/components/app/store'
import cn from '@/utils/classnames'
export type IPromptValuePanelProps = {
export interface IPromptValuePanelProps {
appType: AppType
onSend?: () => void
inputs: Inputs

View File

@ -21,13 +21,13 @@ import { useToastContext } from '@/app/components/base/toast'
import AppIcon from '@/app/components/base/app-icon'
const systemTypes = ['api']
type ExternalDataToolModalProps = {
interface ExternalDataToolModalProps {
data: ExternalDataTool
onCancel: () => void
onSave: (externalDataTool: ExternalDataTool) => void
onValidateBeforeSave?: (externalDataTool: ExternalDataTool) => boolean
}
type Provider = {
interface Provider {
key: string
name: string
form_schema?: CodeBasedExtensionItem['form_schema']

View File

@ -1,6 +1,6 @@
import { Fragment, useCallback } from 'react'
import { useCallback } from 'react'
import type { ReactNode } from 'react'
import { Dialog, Transition } from '@headlessui/react'
import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react'
import cn from '@/utils/classnames'
type DialogProps = {
@ -18,10 +18,10 @@ const NewAppDialog = ({
}: DialogProps) => {
const close = useCallback(() => onClose?.(), [onClose])
return (
<Transition appear show={show} as={Fragment}>
<Transition appear show={show}>
<Dialog as="div" className="relative z-40" onClose={close}>
<Transition.Child
as={Fragment}
<TransitionChild
as={'div'}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
@ -30,12 +30,11 @@ const NewAppDialog = ({
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child>
</TransitionChild>
<div className="fixed inset-0">
<div className="flex flex-col items-center justify-center min-h-full pt-[56px]">
<Transition.Child
as={Fragment}
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0 scale-95"
enterTo="opacity-100 scale-100"
@ -43,10 +42,10 @@ const NewAppDialog = ({
leaveFrom="opacity-100 scale-100"
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className={cn('grow relative w-full h-[calc(100vh-56px)] p-0 overflow-hidden text-left align-middle transition-all transform bg-white shadow-xl rounded-t-xl', className)}>
<DialogPanel className={cn('grow relative w-full h-[calc(100vh-56px)] p-0 overflow-hidden text-left align-middle transition-all transform bg-white shadow-xl rounded-t-xl', className)}>
{children}
</Dialog.Panel>
</Transition.Child>
</DialogPanel>
</TransitionChild>
</div>
</div>
</Dialog>

View File

@ -29,7 +29,7 @@ import Tooltip from '@/app/components/base/tooltip'
import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
import { getRedirection } from '@/utils/app-redirection'
type CreateAppDialogProps = {
interface CreateAppDialogProps {
show: boolean
onSuccess: () => void
onClose: () => void

View File

@ -22,7 +22,7 @@ import { NEED_REFRESH_APP_LIST_KEY } from '@/config'
import { getRedirection } from '@/utils/app-redirection'
import cn from '@/utils/classnames'
type CreateFromDSLModalProps = {
interface CreateFromDSLModalProps {
show: boolean
onSuccess?: () => void
onClose: () => void

View File

@ -13,7 +13,7 @@ import { useProviderContext } from '@/context/provider-context'
import AppsFull from '@/app/components/billing/apps-full-in-dialog'
import type { AppIconType } from '@/types/app'
export type DuplicateAppModalProps = {
export interface DuplicateAppModalProps {
appName: string
icon_type: AppIconType | null
icon: string

View File

@ -12,7 +12,7 @@ import { PageType } from '@/app/components/base/features/new-feature-panel/annot
import TabSlider from '@/app/components/base/tab-slider-plain'
import { useStore as useAppStore } from '@/app/components/app/store'
type Props = {
interface Props {
pageType: PageType
}

View File

@ -27,7 +27,7 @@ export const TIME_PERIOD_LIST = [
{ value: 'all', name: 'allTime' },
]
type IFilterProps = {
interface IFilterProps {
isChatMode?: boolean
appId: string
queryParams: QueryParam

View File

@ -17,11 +17,11 @@ import Loading from '@/app/components/base/loading'
import { fetchChatConversations, fetchCompletionConversations } from '@/service/log'
import { APP_PAGE_LIMIT } from '@/config'
import type { App, AppMode } from '@/types/app'
export type ILogsProps = {
export interface ILogsProps {
appDetail: App
}
export type QueryParam = {
export interface QueryParam {
period?: number | string
annotation_status?: string
keyword?: string

View File

@ -47,7 +47,7 @@ import { getProcessedFilesFromResponse } from '@/app/components/base/file-upload
dayjs.extend(utc)
dayjs.extend(timezone)
type IConversationList = {
interface IConversationList {
logs?: ChatConversationsResponse | CompletionConversationsResponse
appDetail: App
onRefresh: () => void
@ -55,7 +55,7 @@ type IConversationList = {
const defaultValue = 'N/A'
type IDrawerContext = {
interface IDrawerContext {
onClose: () => void
appDetail?: App
}
@ -158,7 +158,7 @@ const getFormattedChatList = (messages: ChatMessage[], conversationId: string, t
// const displayedParams = CompletionParams.slice(0, -2)
const validatedParams = ['temperature', 'top_p', 'presence_penalty', 'frequency_penalty']
type IDetailPanel = {
interface IDetailPanel {
detail: any
onFeedback: FeedbackFunc
onSubmitAnnotation: SubmitAnnotationFunc

View File

@ -20,7 +20,7 @@ const Progress: FC<IProgressProps> = ({
className={cn(s.bar, exhausted && s['bar-error'], 'absolute top-0 left-0 right-0 bottom-0')}
style={{ width: `${value}%` }}
/>
{Array(10).fill(0).map((i, k) => (
{Array.from({ length: 10 }).fill(0).map((i, k) => (
<div key={k} className={s['bar-item']} />
))}
</div>

View File

@ -216,8 +216,8 @@ const Chart: React.FC<IChartProps> = ({
return `<div style='color:#6B7280;font-size:12px'>${params.name}</div>
<div style='font-size:14px;color:#1F2A37'>${valueFormatter((params.data as any)[yField])}
${!CHART_TYPE_CONFIG[chartType].showTokens
? ''
: `<span style='font-size:12px'>
? ''
: `<span style='font-size:12px'>
<span style='margin-left:4px;color:#6B7280'>(</span>
<span style='color:#FF8A4C'>~$${get(params.data, 'total_price', 0)}</span>
<span style='color:#6B7280'>)</span>
@ -243,7 +243,7 @@ const Chart: React.FC<IChartProps> = ({
? ''
: <span>{t('appOverview.analysis.tokenUsage.consumed')} Tokens<span className='text-sm'>
<span className='ml-1 text-gray-500'>(</span>
<span className='text-orange-400'>~{sum(statistics.map(item => parseFloat(get(item, 'total_price', '0')))).toLocaleString('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 4 })}</span>
<span className='text-orange-400'>~{sum(statistics.map(item => Number.parseFloat(get(item, 'total_price', '0')))).toLocaleString('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 4 })}</span>
<span className='text-gray-500'>)</span>
</span></span>}
textStyle={{ main: `!text-3xl !font-normal ${sumData === 0 ? '!text-gray-300' : ''}` }} />

View File

@ -35,12 +35,12 @@ const OPTION_MAP = {
`<script>
window.difyChatbotConfig = {
token: '${token}'${isTestEnv
? `,
? `,
isDev: true`
: ''}${IS_CE_EDITION
? `,
: ''}${IS_CE_EDITION
? `,
baseUrl: '${url}'`
: ''}
: ''}
}
</script>
<script

View File

@ -22,7 +22,7 @@ import AppContext, { useAppContext } from '@/context/app-context'
import type { AppIconSelection } from '@/app/components/base/app-icon-picker'
import AppIconPicker from '@/app/components/base/app-icon-picker'
export type ISettingsModalProps = {
export interface ISettingsModalProps {
isChat: boolean
appInfo: AppDetailResponse & Partial<AppSSO>
isShow: boolean
@ -31,7 +31,7 @@ export type ISettingsModalProps = {
onSave?: (params: ConfigParams) => Promise<void>
}
export type ConfigParams = {
export interface ConfigParams {
title: string
description: string
default_language: string

View File

@ -2,7 +2,7 @@ import { create } from 'zustand'
import type { App, AppSSO } from '@/types/app'
import type { IChatItem } from '@/app/components/base/chat/chat/type'
type State = {
interface State {
appDetail?: App & Partial<AppSSO>
appSidebarExpand: string
currentLogItem?: IChatItem
@ -13,7 +13,7 @@ type State = {
showAppConfigureFeaturesModal: boolean
}
type Action = {
interface Action {
setAppDetail: (appDetail?: App & Partial<AppSSO>) => void
setAppSiderbarExpand: (state: string) => void
setCurrentLogItem: (item?: IChatItem) => void

View File

@ -25,7 +25,7 @@ import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/aler
import AppIcon from '@/app/components/base/app-icon'
import { useStore as useAppStore } from '@/app/components/app/store'
type SwitchAppModalProps = {
interface SwitchAppModalProps {
show: boolean
appDetail: App
onSuccess?: () => void

View File

@ -33,7 +33,7 @@ import { useChatContext } from '@/app/components/base/chat/chat/context'
const MAX_DEPTH = 3
export type IGenerationItemProps = {
export interface IGenerationItemProps {
isWorkflow?: boolean
workflowProcessData?: WorkflowProcess
className?: string

View File

@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
import { RiCloseLine } from '@remixicon/react'
import Run from '@/app/components/workflow/run'
type ILogDetail = {
interface ILogDetail {
runID: string
onClose: () => void
}

View File

@ -6,7 +6,7 @@ import type { QueryParam } from './index'
import Chip from '@/app/components/base/chip'
import Input from '@/app/components/base/input'
type IFilterProps = {
interface IFilterProps {
queryParams: QueryParam
setQueryParams: (v: QueryParam) => void
}

View File

@ -16,11 +16,11 @@ import { fetchWorkflowLogs } from '@/service/log'
import { APP_PAGE_LIMIT } from '@/config'
import type { App, AppMode } from '@/types/app'
export type ILogsProps = {
export interface ILogsProps {
appDetail: App
}
export type QueryParam = {
export interface QueryParam {
status?: string
keyword?: string
}

View File

@ -13,7 +13,7 @@ import Indicator from '@/app/components/header/indicator'
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import useTimestamp from '@/hooks/use-timestamp'
type ILogs = {
interface ILogs {
logs?: WorkflowLogsResponse
appDetail?: App
onRefresh: () => void

View File

@ -2,9 +2,7 @@
@layer components {
.action-btn {
@apply inline-flex justify-center items-center cursor-pointer text-text-tertiary
hover:text-text-secondary
hover:bg-state-base-hover
@apply inline-flex justify-center items-center cursor-pointer text-text-tertiary hover:text-text-secondary hover:bg-state-base-hover
}
.action-btn-disabled {
@ -29,21 +27,15 @@
}
.action-btn.action-btn-active {
@apply
text-text-accent
bg-state-accent-active
hover:bg-state-accent-active-alt
@apply text-text-accent bg-state-accent-active hover:bg-state-accent-active-alt
}
.action-btn.action-btn-disabled {
@apply
text-text-disabled
@apply text-text-disabled
}
.action-btn.action-btn-destructive {
@apply
text-text-destructive
bg-state-destructive-hover
@apply text-text-destructive bg-state-destructive-hover
}
}

View File

@ -28,7 +28,7 @@ const actionButtonVariants = cva(
)
export type ActionButtonProps = {
size?: 'xs' | 'm' | 'l' | 'xl'
size?: 'xs' | 's' | 'm' | 'l' | 'xl'
state?: ActionButtonState
styleCss?: CSSProperties
} & React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof actionButtonVariants>

View File

@ -1,6 +1,6 @@
import AudioPlayer from '@/app/components/base/audio-btn/audio'
declare global {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
// eslint-disable-next-line ts/consistent-type-definitions
interface AudioPlayerManager {
instance: AudioPlayerManager
}
@ -12,6 +12,7 @@ export class AudioPlayerManager {
private audioPlayers: AudioPlayer | null = null
private msgId: string | undefined
// eslint-disable-next-line
private constructor() {
}

View File

@ -2,7 +2,7 @@ import Toast from '@/app/components/base/toast'
import { textToAudioStream } from '@/service/share'
declare global {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
// eslint-disable-next-line ts/consistent-type-definitions
interface Window {
ManagedMediaSource: any
}

View File

@ -7,7 +7,7 @@ import Tooltip from '@/app/components/base/tooltip'
import Loading from '@/app/components/base/loading'
import { AudioPlayerManager } from '@/app/components/base/audio-btn/audio.player.manager'
type AudioBtnProps = {
interface AudioBtnProps {
id?: string
voice?: string
value?: string

View File

@ -55,7 +55,7 @@ const AudioPlayer: React.FC<AudioPlayerProps> = ({ src }) => {
audio.load()
// Delayed generation of waveform data
// eslint-disable-next-line @typescript-eslint/no-use-before-define
// eslint-disable-next-line ts/no-use-before-define
const timer = setTimeout(() => generateWaveformData(src), 1000)
return () => {

View File

@ -49,4 +49,6 @@ const AutoHeightTextarea = forwardRef<HTMLTextAreaElement, AutoHeightTextareaPro
},
)
AutoHeightTextarea.displayName = 'AutoHeightTextarea'
export default AutoHeightTextarea

View File

@ -5,22 +5,28 @@ type BadgeProps = {
className?: string
text: string
uppercase?: boolean
hasRedCornerMark?: boolean
}
const Badge = ({
className,
text,
uppercase = true,
hasRedCornerMark,
}: BadgeProps) => {
return (
<div
className={cn(
'inline-flex items-center px-[5px] h-5 rounded-[5px] border border-divider-deep leading-3 text-text-tertiary',
'relative inline-flex items-center px-[5px] h-5 rounded-[5px] border border-divider-deep leading-3 text-text-tertiary',
uppercase ? 'system-2xs-medium-uppercase' : 'system-xs-medium',
className,
)}
>
{text}
{hasRedCornerMark && (
<div className='absolute top-[-2px] right-[-2px] w-1.5 h-1.5 border border-components-badge-status-light-error-border-inner bg-components-badge-status-light-error-bg rounded-[2px] shadow-sm'>
</div>
)}
</div>
)
}

View File

@ -0,0 +1,28 @@
@tailwind components;
@layer components {
.badge {
@apply inline-flex justify-center items-center text-text-tertiary border border-divider-deep
}
.badge-l {
@apply rounded-md gap-1 min-w-6
}
/* m is for the regular button */
.badge-m {
@apply rounded-md gap-[3px] min-w-5
}
.badge-s {
@apply rounded-[5px] gap-0.5 min-w-[18px]
}
.badge.badge-warning {
@apply text-text-warning border border-text-warning
}
.badge.badge-accent {
@apply text-text-accent-secondary border border-text-accent-secondary
}
}

View File

@ -0,0 +1,81 @@
import type { CSSProperties, ReactNode } from 'react'
import React from 'react'
import { type VariantProps, cva } from 'class-variance-authority'
import classNames from '@/utils/classnames'
import './index.css'
enum BadgeState {
Warning = 'warning',
Accent = 'accent',
Default = '',
}
const BadgeVariants = cva(
'badge',
{
variants: {
size: {
s: 'badge-s',
m: 'badge-m',
l: 'badge-l',
},
},
defaultVariants: {
size: 'm',
},
},
)
type BadgeProps = {
size?: 's' | 'm' | 'l'
iconOnly?: boolean
uppercase?: boolean
state?: BadgeState
styleCss?: CSSProperties
children?: ReactNode
} & React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof BadgeVariants>
function getBadgeState(state: BadgeState) {
switch (state) {
case BadgeState.Warning:
return 'badge-warning'
case BadgeState.Accent:
return 'badge-accent'
default:
return ''
}
}
const Badge: React.FC<BadgeProps> = ({
className,
size,
state = BadgeState.Default,
iconOnly = false,
uppercase = false,
styleCss,
children,
...props
}) => {
return (
<div
className={classNames(
BadgeVariants({ size, className }),
getBadgeState(state),
size === 's'
? (iconOnly ? 'p-[3px]' : 'px-[5px] py-[3px]')
: size === 'l'
? (iconOnly ? 'p-1.5' : 'px-2 py-1')
: (iconOnly ? 'p-1' : 'px-[5px] py-[2px]'),
uppercase ? 'system-2xs-medium-uppercase' : 'system-2xs-medium',
)}
style={styleCss}
{...props}
>
{children}
</div>
)
}
Badge.displayName = 'Badge'
export default Badge
export { Badge, BadgeState, BadgeVariants }

View File

@ -4,7 +4,7 @@ import React from 'react'
import { RiAddLine } from '@remixicon/react'
import cn from '@/utils/classnames'
type Props = {
interface Props {
className?: string
onClick: () => void
}

View File

@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { memo } from 'react'
import Textarea from '@/app/components/base/textarea'
type InputProps = {
interface InputProps {
form: any
value: string
onChange: (variable: string, value: string) => void

View File

@ -16,7 +16,7 @@ import type {
ConversationItem,
} from '@/models/share'
export type ChatWithHistoryContextValue = {
export interface ChatWithHistoryContextValue {
appInfoError?: any
appInfoLoading?: boolean
appMeta?: AppMeta

View File

@ -20,7 +20,7 @@ import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
import { checkOrSetAccessToken } from '@/app/components/share/utils'
import AppUnavailable from '@/app/components/base/app-unavailable'
type ChatWithHistoryProps = {
interface ChatWithHistoryProps {
className?: string
}
const ChatWithHistory: FC<ChatWithHistoryProps> = ({
@ -99,7 +99,7 @@ const ChatWithHistory: FC<ChatWithHistoryProps> = ({
)
}
export type ChatWithHistoryWrapProps = {
export interface ChatWithHistoryWrapProps {
installedAppInfo?: InstalledApp
className?: string
}

View File

@ -8,7 +8,7 @@ import Thought from '@/app/components/base/chat/chat/thought'
import { FileList } from '@/app/components/base/file-uploader'
import { getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils'
type AgentContentProps = {
interface AgentContentProps {
item: ChatItem
responding?: boolean
}

View File

@ -4,7 +4,7 @@ import type { ChatItem } from '../../types'
import { Markdown } from '@/app/components/base/markdown'
import cn from '@/utils/classnames'
type BasicContentProps = {
interface BasicContentProps {
item: ChatItem
}
const BasicContent: FC<BasicContentProps> = ({

View File

@ -23,7 +23,7 @@ import { ChevronRight } from '@/app/components/base/icons/src/vender/line/arrows
import cn from '@/utils/classnames'
import { FileList } from '@/app/components/base/file-uploader'
type AnswerProps = {
interface AnswerProps {
item: ChatItem
question: string
index: number

View File

@ -21,7 +21,7 @@ import {
import Tooltip from '@/app/components/base/tooltip'
import Log from '@/app/components/base/chat/chat/log'
type OperationProps = {
interface OperationProps {
item: ChatItem
question: string
index: number

View File

@ -17,7 +17,7 @@ import { CheckCircle } from '@/app/components/base/icons/src/vender/solid/genera
import { WorkflowRunningStatus } from '@/app/components/workflow/types'
import { useStore as useAppStore } from '@/app/components/app/store'
type WorkflowProcessProps = {
interface WorkflowProcessProps {
data: WorkflowProcess
item?: ChatItem
expand?: boolean

View File

@ -33,7 +33,7 @@ import {
} from '@/app/components/base/file-uploader/utils'
type GetAbortController = (abortController: AbortController) => void
type SendCallback = {
interface SendCallback {
onGetConversationMessages?: (conversationId: string, getAbortController: GetAbortController) => Promise<any>
onGetSuggestedQuestions?: (responseItemId: string, getAbortController: GetAbortController) => Promise<any>
onConversationComplete?: (conversationId: string) => void

View File

@ -35,7 +35,7 @@ import PromptLogModal from '@/app/components/base/prompt-log-modal'
import { useStore as useAppStore } from '@/app/components/app/store'
import type { AppData } from '@/models/share'
export type ChatProps = {
export interface ChatProps {
appData?: AppData
chatList: ChatItem[]
config?: ChatConfig

View File

@ -12,7 +12,7 @@ import { User } from '@/app/components/base/icons/src/public/avatar'
import { Markdown } from '@/app/components/base/markdown'
import { FileList } from '@/app/components/base/file-uploader'
type QuestionProps = {
interface QuestionProps {
item: ChatItem
questionIcon?: ReactNode
theme: Theme | null | undefined

View File

@ -4,7 +4,7 @@ import React from 'react'
import type { ThoughtItem, ToolInfoInThought } from '../type'
import ToolDetail from '@/app/components/base/chat/chat/answer/tool-detail'
export type IThoughtProps = {
export interface IThoughtProps {
thought: ThoughtItem
isFinished: boolean
}

View File

@ -4,13 +4,13 @@ import type { FileEntity } from '@/app/components/base/file-uploader/types'
import type { InputVarType } from '@/app/components/workflow/types'
import type { FileResponse } from '@/types/workflow'
export type MessageMore = {
export interface MessageMore {
time: string
tokens: number
latency: number | string
}
export type FeedbackType = {
export interface FeedbackType {
rating: MessageRating
content?: string | null
}
@ -26,7 +26,7 @@ export type SubmitAnnotationFunc = (
export type DisplayScene = 'web' | 'console'
export type ToolInfoInThought = {
export interface ToolInfoInThought {
name: string
label: string
input: string
@ -34,7 +34,7 @@ export type ToolInfoInThought = {
isFinished: boolean
}
export type ThoughtItem = {
export interface ThoughtItem {
id: string
tool: string // plugin or dataset. May has multi.
thought: string
@ -47,7 +47,7 @@ export type ThoughtItem = {
message_files?: FileEntity[]
}
export type CitationItem = {
export interface CitationItem {
content: string
data_source_type: string
dataset_name: string
@ -62,7 +62,7 @@ export type CitationItem = {
word_count: number
}
export type IChatItem = {
export interface IChatItem {
id: string
content: string
citation?: CitationItem[]
@ -104,7 +104,7 @@ export type IChatItem = {
nextSibling?: string
}
export type Metadata = {
export interface Metadata {
retriever_resources?: CitationItem[]
annotation_reply: {
id: string
@ -115,20 +115,20 @@ export type Metadata = {
}
}
export type MessageEnd = {
export interface MessageEnd {
id: string
metadata: Metadata
files?: FileResponse[]
}
export type MessageReplace = {
export interface MessageReplace {
id: string
task_id: string
answer: string
conversation_id: string
}
export type AnnotationReply = {
export interface AnnotationReply {
id: string
task_id: string
answer: string
@ -137,7 +137,7 @@ export type AnnotationReply = {
annotation_author_name: string
}
export type InputForm = {
export interface InputForm {
type: InputVarType
label: string
variable: any

View File

@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { memo } from 'react'
import Textarea from '@/app/components/base/textarea'
type InputProps = {
interface InputProps {
form: any
value: string
onChange: (variable: string, value: string) => void

View File

@ -15,7 +15,7 @@ import type {
ConversationItem,
} from '@/models/share'
export type EmbeddedChatbotContextValue = {
export interface EmbeddedChatbotContextValue {
appInfoError?: any
appInfoLoading?: boolean
appMeta?: AppMeta

View File

@ -14,32 +14,32 @@ export type {
PromptVariable,
} from '@/models/debug'
export type UserInputForm = {
export interface UserInputForm {
default: string
label: string
required: boolean
variable: string
}
export type UserInputFormTextInput = {
export interface UserInputFormTextInput {
'text-input': UserInputForm & {
max_length: number
}
}
export type UserInputFormSelect = {
'select': UserInputForm & {
export interface UserInputFormSelect {
select: UserInputForm & {
options: string[]
}
}
export type UserInputFormParagraph = {
'paragraph': UserInputForm
export interface UserInputFormParagraph {
paragraph: UserInputForm
}
export type VisionConfig = VisionSettings
export type EnableType = {
export interface EnableType {
enabled: boolean
}
@ -50,7 +50,7 @@ export type ChatConfig = Omit<ModelConfig, 'model'> & {
supportCitationHitInfo?: boolean
}
export type WorkflowProcess = {
export interface WorkflowProcess {
status: WorkflowRunningStatus
tracing: NodeTracing[]
expand?: boolean // for UI
@ -73,10 +73,10 @@ export type OnSend = (message: string, files?: FileEntity[], last_answer?: ChatI
export type OnRegenerate = (chatItem: ChatItem) => void
export type Callback = {
export interface Callback {
onSuccess: () => void
}
export type Feedback = {
export interface Feedback {
rating: 'like' | 'dislike' | null
}

View File

@ -1,6 +1,7 @@
'use client'
import { useState } from 'react'
import { t } from 'i18next'
import { debounce } from 'lodash-es'
import copy from 'copy-to-clipboard'
import s from './style.module.css'
import Tooltip from '@/app/components/base/tooltip'
@ -18,22 +19,29 @@ const CopyBtn = ({
}: ICopyBtnProps) => {
const [isCopied, setIsCopied] = useState(false)
const onClickCopy = debounce(() => {
copy(value)
setIsCopied(true)
}, 100)
const onMouseLeave = debounce(() => {
setIsCopied(false)
}, 100)
return (
<div className={`${className}`}>
<Tooltip
popupContent={(isCopied ? t('appApi.copied') : t('appApi.copy'))}
>
<div
onMouseLeave={onMouseLeave}
className={'box-border p-0.5 flex items-center justify-center rounded-md bg-white cursor-pointer'}
style={!isPlain
? {
boxShadow: '0px 4px 8px -2px rgba(16, 24, 40, 0.1), 0px 2px 4px -2px rgba(16, 24, 40, 0.06)',
}
: {}}
onClick={() => {
copy(value)
setIsCopied(true)
}}
onClick={onClickCopy}
>
<div className={`w-6 h-6 rounded-md hover:bg-gray-50 ${s.copyIcon} ${isCopied ? s.copied : ''}`}></div>
</div>

Some files were not shown because too many files have changed in this diff Show More