Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: GROWI AI Next #9492

Open
wants to merge 290 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
290 commits
Select commit Hold shift + click to select a range
c0c9bc0
not optional
miya Dec 19, 2024
5f4ba68
Revert "Add field (isDeleted)"
miya Dec 19, 2024
eafecf9
Refactor AiAssistant model to use vectorStore reference and export Ve…
miya Dec 19, 2024
d754820
Add option to include subordinated pages in page selection modal
miya Dec 19, 2024
5714a18
rm debug log
miya Dec 19, 2024
a6f79e0
Add grantedUsers field to AiAssistant model for user-specific sharing
miya Dec 20, 2024
f3b97fb
Merge pull request #9505 from weseek/imprv/159329-modify-page-select-…
yuki-takei Dec 20, 2024
d63af50
Merge branch 'feat/growi-ai-next' into feat/159152-ai-assistant-model
miya Dec 23, 2024
568a4e6
Merge branch 'master' into feat/growi-ai-next
miya Dec 24, 2024
90bf8f8
Add assistant description and update icon in AiChatModal component
miya Dec 24, 2024
820784a
Create SelectedPageList.tsx
miya Dec 24, 2024
815deee
Merge branch 'feat/growi-ai-next' into feat/159152-ai-assistant-model
miya Dec 24, 2024
10c7773
Rename learningScope to ownerAccessScope in AiAssistant model for cla…
miya Dec 24, 2024
f661d11
Rename AiAssistantSharingScope to AiAssistantShareScope for consistency
miya Dec 24, 2024
752768a
Update enum reference for shareScope to use AiAssistantShareScope
miya Dec 24, 2024
0775170
Add pagePaths property to AiAssistant model for enhanced functionality
miya Dec 24, 2024
52db218
Update AiAssistantManagementModal to enhance user instructions and ad…
miya Dec 24, 2024
c19d6a9
Add remove functionality for selected pages in AiAssistantManagementM…
miya Dec 24, 2024
99796c1
onClickOpenPageSelectModalButton -> clickOpenPageSelectModalHandle
miya Dec 24, 2024
1919825
Add select input and buttons for assistant functionality
miya Dec 24, 2024
a65c48d
fix styles
miya Dec 25, 2024
c5e73e7
pagePath -> pagePathPatterns
miya Dec 25, 2024
0dfb8ef
Merge pull request #9494 from weseek/feat/159152-ai-assistant-model
yuki-takei Dec 25, 2024
67fa754
Merge pull request #9519 from weseek/feat/159566-knowledge-assistant-…
yuki-takei Dec 25, 2024
436b76b
Merge pull request #9518 from weseek/feat/159531-chat-modal
yuki-takei Dec 25, 2024
69a5165
Merge branch 'master' into feat/growi-ai-next
miya Dec 27, 2024
744f588
Merge branch 'feat/growi-ai-next' into feat/159153-implement-ai-assis…
miya Dec 27, 2024
319925c
Merge branch 'master' into feat/growi-ai-next
miya Jan 6, 2025
9839181
Merge branch 'feat/growi-ai-next' into feat/159153-implement-ai-assis…
miya Jan 6, 2025
66be0a2
Add AI assistant types and scopes interfaces
miya Jan 9, 2025
2e9ca2d
Enhance validation for AI assistant creation API
miya Jan 9, 2025
adc175f
createAssistantFactory -> createAiAssistantFactory
miya Jan 9, 2025
be160c3
Omit AiAssistant.type
miya Jan 9, 2025
7c5e43f
Refactor AI assistant interfaces and service implementation
miya Jan 9, 2025
1d58f5d
Refactor AI assistant service to use OpenAI service for assistant cre…
miya Jan 9, 2025
f8c5918
fix path
miya Jan 9, 2025
fac67f0
imprv validation
miya Jan 9, 2025
5c2de9d
create-assistant -> create-ai-assistant
miya Jan 9, 2025
abda9dc
clean code
miya Jan 9, 2025
e4002ed
Impl addConditionToListByPathsArrayWithGlob
miya Jan 10, 2025
d703468
Enabled to create a specialized vectorStore
miya Jan 10, 2025
2df37fd
Remove scopeType from VectorStore and related methods
miya Jan 10, 2025
b18d188
Comment out currently unavailable methods
miya Jan 10, 2025
93c382a
rm addConditionToListByPathsArrayWithGlob method
miya Jan 10, 2025
28c128f
create-ai-assistant -> ai-assistant
miya Jan 16, 2025
0c224e5
AssistantOwnerAccessScope -> AssistantAccessScope
miya Jan 16, 2025
caeb96b
Omit grantedUsers
miya Jan 16, 2025
d56ce31
Merge pull request #9497 from weseek/feat/159153-implement-ai-assista…
miya Jan 16, 2025
211e444
Merge branch 'feat/growi-ai-next' into feat/160044-implement-logic-fo…
miya Jan 16, 2025
42d437b
add shash
miya Jan 16, 2025
6002af9
ownerAccessScope -> accessScope
miya Jan 16, 2025
c991c71
Add TODO
miya Jan 16, 2025
b0a65dc
Refactor createVectorStore method to accept a name parameter for dyna…
miya Jan 16, 2025
ade8f95
Add grob pattern path validation
miya Jan 16, 2025
f38352c
Refactor path condition creation to use convertPathPatternsToRegExp f…
miya Jan 16, 2025
da0041c
VectorStoreFile no longer waits for creation
miya Jan 16, 2025
03377b8
Merge pull request #9545 from weseek/feat/160044-implement-logic-for-…
miya Jan 16, 2025
47996e2
impl createConditionForCreateAiAssistant
miya Jan 17, 2025
c85c8bb
Imprv types
miya Jan 17, 2025
4af55fc
imprv conditions
miya Jan 17, 2025
17b9207
add comment
miya Jan 19, 2025
d828442
imprv access control logic for owner scope
miya Jan 20, 2025
cd7c054
add ExternalUserGroupRelation.
miya Jan 20, 2025
27cf3cd
impl
miya Jan 20, 2025
f033164
Update pagePathPatterns handling in AiAssistantManagementModal for dy…
miya Jan 20, 2025
37a57b8
fix lint error
miya Jan 20, 2025
22f60ab
fix debug log
miya Jan 20, 2025
e8342e4
Merge pull request #9552 from weseek/feat/160099-condition-for-owners…
yuki-takei Jan 20, 2025
9630de7
Merge branch 'feat/growi-ai-next' into feat/159176-implementation-of-…
miya Jan 20, 2025
6e3173c
add IApiv3AiAssistantCreateParams
miya Jan 20, 2025
7367ca9
Merge pull request #9561 from weseek/feat/159176-implementation-of-an…
miya Jan 20, 2025
f2ee61c
impl
miya Jan 20, 2025
693312e
fix comment
miya Jan 21, 2025
8be3e4f
add debug looger
miya Jan 21, 2025
ad3f98f
add user-related routes and handler for fetching related groups
miya Jan 21, 2025
bc4c62c
impl useSWRxUserRelatedGroups
miya Jan 21, 2025
b6259b1
Merge pull request #9562 from weseek/feat/160518-enable-learning-rest…
yuki-takei Jan 21, 2025
c39133c
IUserGroupRelation[] -> IGrantedGroup[]
miya Jan 21, 2025
1ae31de
impl type Populated
miya Jan 21, 2025
b53cbef
(wip) impl ShareScopeDropdown.tsx
miya Jan 21, 2025
93f6b0b
Use $in
miya Jan 21, 2025
a62c1c6
Merge pull request #9569 from weseek/fix/query-for-create-condition-f…
miya Jan 21, 2025
30081ba
impl getAiAssistantsFactory
miya Jan 22, 2025
61a5c76
clean code
miya Jan 22, 2025
810db42
rm unnec mioddleware
miya Jan 22, 2025
6ddfb13
add accessible AI assistants interface and update service methods
miya Jan 22, 2025
d314f30
getAiAssistantsFactory -> etAccessibleAiAssistantsFactory
miya Jan 22, 2025
7929381
implement retrieval of teamAiAssistants
miya Jan 22, 2025
a853da8
refactor getAccessibleAiAssistants to consolidate assistant retrieval…
miya Jan 22, 2025
1282a1a
ownerUserGroup -> ownerUserGroups
miya Jan 22, 2025
ff4be4e
small fix
miya Jan 22, 2025
a770ebb
Merge branch 'master' into feat/growi-ai-next
miya Jan 22, 2025
1acd655
Merge branch 'feat/growi-ai-next' into feat/160452-enable-selecting-m…
miya Jan 22, 2025
273aea9
Merge branch 'feat/growi-ai-next' into feat/160587-implement-api-to-f…
miya Jan 22, 2025
db3f03f
Revert "Merge branch 'master' into feat/growi-ai-next"
miya Jan 22, 2025
e6795da
Merge branch 'feat/growi-ai-next' into feat/160587-implement-api-to-f…
miya Jan 22, 2025
14a1518
Merge branch 'feat/growi-ai-next' into feat/160452-enable-selecting-m…
miya Jan 22, 2025
f9d65f9
Reapply "Merge branch 'master' into feat/growi-ai-next"
miya Jan 22, 2025
3c03ef6
Revert "Merge pull request #9572 from weseek/support/upgrade-react"
miya Jan 22, 2025
bbf8c87
Reapply "Merge pull request #9572 from weseek/support/upgrade-react"
miya Jan 22, 2025
e7577e5
Merge branch 'feat/growi-ai-next' into feat/160452-enable-selecting-m…
miya Jan 22, 2025
d18b8b8
Merge branch 'feat/growi-ai-next' into feat/160587-implement-api-to-f…
miya Jan 22, 2025
1ec1141
Merge branch 'master' into feat/growi-ai-next
miya Jan 23, 2025
2783fb3
Merge branch 'feat/growi-ai-next' into feat/160587-implement-api-to-f…
miya Jan 23, 2025
fb679c7
Merge branch 'feat/growi-ai-next' into feat/160452-enable-selecting-m…
miya Jan 23, 2025
08ff22e
Split route file
miya Jan 23, 2025
690bafa
fix type
miya Jan 23, 2025
eafecd6
add grantedGroupsForShareScope and grantedGroupsForAccessScope
miya Jan 23, 2025
d279c5e
AiAssistantAccessScope -> AiAssistantShareScope
miya Jan 23, 2025
33811db
add styles
miya Jan 23, 2025
7c2a97c
revert code
miya Jan 23, 2025
f6351a9
rm unnec line
miya Jan 23, 2025
231c454
fix type
miya Jan 23, 2025
d7ef882
add d.ts
miya Jan 27, 2025
fd7f0f0
fix type
miya Jan 27, 2025
d5c1061
Revert "fix type"
miya Jan 27, 2025
b05ff48
Revert "add d.ts"
miya Jan 27, 2025
adfb40b
Merge pull request #9563 from weseek/feat/160452-enable-selecting-mem…
miya Jan 27, 2025
60c7884
Merge pull request #9573 from weseek/feat/160587-implement-api-to-fet…
miya Jan 27, 2025
d7fbee9
Impl
miya Jan 28, 2025
0461428
diet code
miya Jan 28, 2025
ddc64ba
impl UserGroupSelector
miya Jan 28, 2025
b7992a7
Implementing UserGroupSelector Logic
miya Jan 29, 2025
f4a867b
Set value to API client
miya Jan 29, 2025
51a237c
Refactor AccessScopeDropdown and UserGroupSelector to update user gro…
miya Jan 29, 2025
2fed5b7
Update grantedGroupsForAccessScope condition in AiAssistantManagement…
miya Jan 29, 2025
4496167
diet
miya Jan 29, 2025
49a954a
rename
miya Jan 29, 2025
dd980de
Redesign AiAssistantManagementModal
miya Jan 29, 2025
2f78b7d
rm unect class
miya Jan 29, 2025
4e709df
fix typo
miya Jan 30, 2025
764c6b6
fix typo
miya Jan 30, 2025
aad5ebc
rename AiAssistantManagementModal file and update import paths
miya Jan 30, 2025
2711c4b
add style for custom name
miya Jan 30, 2025
9f7a32b
i18n for each page mode
miya Jan 30, 2025
abba9a5
fix typo
miya Jan 30, 2025
33ab5da
impl
miya Jan 30, 2025
c00be4e
design revamp
miya Jan 30, 2025
c43e2c0
cleanup
miya Jan 30, 2025
0bb96fd
Merge pull request #9600 from weseek/feat/160855-edit-referenced-page
miya Jan 30, 2025
c198f67
Use reactstrap
miya Jan 31, 2025
3ce6b8f
Merge pull request #9598 from weseek/feat/160864-redesign-ai-assistan…
miya Jan 31, 2025
5e70cbb
Merge branch 'feat/growi-ai-next' into feat/160664-implement-access-s…
miya Jan 31, 2025
d96694b
Impl AiAssistantManagementEditShare
miya Jan 31, 2025
2e54595
apply new design
miya Jan 31, 2025
b532c47
relocate components
miya Jan 31, 2025
eba21c5
Refactor AccessScopeDropdown and AiAssistantManagementEditShare compo…
miya Jan 31, 2025
239e4d2
Impl ShareScopeSwitch
miya Jan 31, 2025
5a3d9d6
Refactor AiAssistantManagementEditShare to unify scope selection hand…
miya Jan 31, 2025
c13c3b1
Refactor AccessScopeDropdown integration in AiAssistantManagementEdit…
miya Jan 31, 2025
041cb2d
UserGroupSelector -> SelectUserGroupModal
miya Jan 31, 2025
c9517ee
add AiAssistantScopeType
miya Jan 31, 2025
345af5e
Refactor AccessScopeDropdown, AiAssistantManagementEditShare, and Sha…
miya Jan 31, 2025
2e135d6
Refactor AiAssistantManagementEditShare and related components to uni…
miya Jan 31, 2025
da3aaa0
Add Todo
miya Jan 31, 2025
ee34835
Refactor AiAssistantManagementEditShare and ShareScopeSwitch to integ…
miya Feb 1, 2025
d0d4aac
Simpler
miya Feb 1, 2025
ef22eb3
isUserGroupSelectorOpen -> isSelectUserGroupModalOpen
miya Feb 1, 2025
9d0e45d
resolve warning
miya Feb 1, 2025
a5d6a39
diet code
miya Feb 1, 2025
8609f2d
Add owner share scope label to translations and update AiAssistantMan…
miya Feb 1, 2025
fff81f4
Refactor AiAssistantManagementHome to handle name and description cha…
miya Feb 1, 2025
1d18e09
rm unnec code
miya Feb 1, 2025
d80cbdd
Add isDisabledGroups prop to AccessScopeDropdown and ShareScopeSwitch…
miya Feb 1, 2025
d470282
Add userRelatedGroups prop to SelectUserGroupModal and update related…
miya Feb 1, 2025
8aecff6
impl convertToGrantedGroups
miya Feb 3, 2025
b5665de
fix i18n
miya Feb 3, 2025
89ee6c1
add SAME_AS_ACCESS_SCOPE
miya Feb 3, 2025
1067b32
Close modal after creating an assistant
miya Feb 3, 2025
10ebefe
Change ShareScope to “public” when sharing
miya Feb 3, 2025
b2bdb08
Refactor selectScopeHandler
miya Feb 3, 2025
dca9d69
rm unnec code
miya Feb 3, 2025
1c23945
Impl ShareScopeWarningModal
miya Feb 3, 2025
9431da8
Refactor selectScopeHandler
miya Feb 4, 2025
879700f
Refactor selectUserGroupsHandler
miya Feb 4, 2025
7f67580
Merge branch 'feat/160664-implement-access-scope-dropdown' into feat/…
miya Feb 4, 2025
07825af
add toggle
miya Feb 4, 2025
e02c09d
fix styles
miya Feb 4, 2025
0e6286f
add todo
miya Feb 4, 2025
a490e0d
fix styles
miya Feb 4, 2025
df1cce3
fix type
miya Feb 4, 2025
2bc0fa5
Merge branch 'feat/growi-ai-next' into feat/160587-
miya Feb 4, 2025
35999ce
Merge branch 'master' into feat/growi-ai-next
miya Feb 5, 2025
bcb8bd6
Merge branch 'feat/growi-ai-next' into feat/160664-implement-access-s…
miya Feb 5, 2025
c0cb9d5
Merge branch 'feat/160664-implement-access-scope-dropdown' into feat/…
miya Feb 5, 2025
30739f1
Merge branch 'feat/growi-ai-next' into feat/160587-implement-ai-assis…
miya Feb 5, 2025
f84eae4
Impl api
miya Feb 5, 2025
b778028
Implement logic to delete AiAssistant and related VectorStore
miya Feb 5, 2025
8e168dc
Only assistant created by owner can be deleted
miya Feb 5, 2025
94497c9
fix typo
miya Feb 5, 2025
2e63313
Add deleteAiAssistant function to handle assistant deletion
miya Feb 5, 2025
7e0165f
fix error handling
miya Feb 5, 2025
4466e6f
fix validation message
miya Feb 5, 2025
1b28717
add ReqParams
miya Feb 5, 2025
0947d79
Merge pull request #9594 from weseek/feat/160664-implement-access-sco…
yuki-takei Feb 5, 2025
f28ad1b
Merge pull request #9626 from weseek/feat/161373-implement-api-to-del…
yuki-takei Feb 5, 2025
277de66
onCreateAiAssistant -> onSubmit
miya Feb 6, 2025
414f2c4
Merge branch 'feat/growi-ai-next' into feat/160857-implement-share-sc…
miya Feb 6, 2025
94aa8ed
fix lint error
miya Feb 6, 2025
48d4804
Merge pull request #9615 from weseek/feat/160857-implement-share-scop…
miya Feb 6, 2025
133bbaf
Merge branch 'feat/growi-ai-next' into feat/160587-implement-ai-assis…
miya Feb 6, 2025
9083149
impl useSWRxAiAssistants
miya Feb 6, 2025
bc6fff4
fix props
miya Feb 6, 2025
a1a5878
Impl AiAssistantTree
miya Feb 6, 2025
1e88a88
adjust styles
miya Feb 6, 2025
4a1ca17
Refactor getShareScopeIcon()
miya Feb 6, 2025
9d35f95
Mutate useSWRxAiAssistants when creating assistants
miya Feb 6, 2025
11a4f77
clean code
miya Feb 6, 2025
7a0a9ee
clean up
miya Feb 6, 2025
8f28b5f
add actions buttons
miya Feb 6, 2025
9432cb4
Refactor AiAssistantItem props
miya Feb 6, 2025
57c96ae
Only assistants created by owner are Operable
miya Feb 6, 2025
4877314
Added the ability to remove assistants from the UI.
miya Feb 6, 2025
0294677
Change the target for firing clickOpenThreadHandler
miya Feb 6, 2025
5014902
fix styles
miya Feb 6, 2025
2595282
add delete thread button
miya Feb 6, 2025
b632d68
fix styles
miya Feb 6, 2025
b554ad7
clean code & add todo
miya Feb 6, 2025
c677155
Use useSWRImmutable
miya Feb 6, 2025
fc98415
Add guest user check to AiAssistant component
miya Feb 6, 2025
8b2dea8
Impl updateAiAssistantsFactory
miya Feb 6, 2025
aa00de4
Impl updateAiAssistant
miya Feb 6, 2025
9e4fc23
Add validator
miya Feb 7, 2025
6e9e8cf
Add AiAssistantTree.module.scss
miya Feb 7, 2025
dd90563
Merge pull request #9617 from weseek/feat/160587-implement-ai-assista…
miya Feb 7, 2025
f84816d
Merge branch 'feat/growi-ai-next' into feat/161504-implement-api-to-u…
miya Feb 7, 2025
51ba4d6
fix arg
miya Feb 7, 2025
3aa3317
Commonize validator
miya Feb 7, 2025
5da9400
clean code
miya Feb 7, 2025
9d0c61a
Commonize interfaces
miya Feb 7, 2025
ccd7c78
AiAssistant Update Logic Implementation
miya Feb 7, 2025
224b848
imprv naming
miya Feb 7, 2025
e0b74c2
impl isDeepEquals
miya Feb 7, 2025
3d297a2
If accessScope, pagePathPatterns, grantedGroupsForAccessScope have no…
miya Feb 7, 2025
ba759e9
Refactor for document return
miya Feb 7, 2025
50206db
Add error handling for uninitialized OpenAI service in AI assistant r…
miya Feb 7, 2025
7022542
Use http-errors
miya Feb 7, 2025
a134c92
fix comment
miya Feb 7, 2025
a62f4e5
Relocate isDeepEquals
miya Feb 7, 2025
66e720f
Merge branch 'master' into feat/growi-ai-next
yuki-takei Feb 7, 2025
1402441
Merge pull request #9630 from weseek/feat/161504-implement-api-to-upd…
miya Feb 7, 2025
bade360
Impl RightSidebar
miya Feb 10, 2025
b2d5978
fix styles
miya Feb 10, 2025
7648ab5
Relocate components
miya Feb 10, 2025
1cb4d0a
Use SWR to manage sidebar open/close
miya Feb 10, 2025
62f8787
delete unnec file
miya Feb 10, 2025
62e7549
Reorganize AiAssistantChatSidebar
miya Feb 10, 2025
34479e4
Add styles (grw-ai-assistant-chat-sidebar)
miya Feb 10, 2025
ae4d77a
Enable AiAssistant data display in RightSidebar
miya Feb 10, 2025
17d31e3
Merge pull request #9640 from weseek/feat/161510-implement-right-sidebar
yuki-takei Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion apps/app/public/static/locales/en_US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
"Page Tree": "Page Tree",
"Bookmarks": "Bookmarks",
"In-App Notification": "Notifications",
"AI Assistant": "AI Assistant",
"Knowledge Assistant": "Knowledge Assistant",
"original_path": "Original path",
"new_path": "New path",
"duplicated_path": "Duplicated path",
Expand Down Expand Up @@ -499,7 +501,36 @@
"budget_exceeded_for_growi_cloud": "You have reached your OpenAI API usage limit. To use the Knowledge Assistant again, please add credits from the GROWI.cloud admin page for Hosted users or from the OpenAI billing page for Owned users.",
"error_message": "An error has occurred",
"show_error_detail": "Show error details"

},
"modal_ai_assistant": {
"default_instruction": "You are the knowledge assistant for this Wiki. Please provide support according to the following guidelines:\n\n- Analyze document relevance and connect information\n- Suggest new perspectives\n- Provide accurate information based on understanding the intent of questions\nI will provide information in a structured format when necessary.",
"page_mode_title": {
"share": "Assistant Sharing",
"pages": "Reference Pages",
"instruction": "Assistant Instructions"
},
"access_scope": {
"owner": "All pages accessible by {{username}}",
"groups": "Specify groups",
"publicOnly": "Public pages only"
},
"share_scope": {
"owner": {
"label": "{{username}} only"
},
"publicOnly": {
"label": "Public",
"desc": "Shared with all users"
},
"groups": {
"label": "Specify groups",
"desc": "Shared only with members of selected groups"
},
"sameAsAccessScope": {
"label": "Same as page access scope",
"desc": "Shared with the same scope as page access"
}
}
},
"link_edit": {
"edit_link": "Edit Link",
Expand Down
32 changes: 32 additions & 0 deletions apps/app/public/static/locales/fr_FR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
"Page Tree": "Arborescence",
"Bookmarks": "Favoris",
"In-App Notification": "Notifications",
"AI Assistant": "Assistant IA",
"Knowledge Assistant": "Assistant de Connaissance",
"original_path": "Chemin originel",
"new_path": "Nouveau chemin",
"duplicated_path": "Chemin dupliqué",
Expand Down Expand Up @@ -495,6 +497,36 @@
"error_message": "Erreur",
"show_error_detail": "Détails de l'exposition"
},
"modal_ai_assistant": {
"default_instruction": "Vous êtes l'assistant de connaissances pour ce Wiki. Veuillez fournir un support selon les directives suivantes :\n\n- Analyser la pertinence des documents et relier les informations\n- Proposer de nouvelles perspectives\n- Fournir des informations précises en comprenant l'intention des questions\nJe fournirai les informations sous forme structurée si nécessaire.",
"page_mode_title": {
"share": "Partage de l'assistant",
"pages": "Pages de référence",
"instruction": "Instructions de l'assistant"
},
"access_scope": {
"owner": "Toutes les pages accessibles par {{username}}",
"groups": "Spécifier les groupes",
"publicOnly": "Pages publiques uniquement"
},
"share_scope": {
"owner": {
"label": "Seulement {{username}}"
},
"publicOnly": {
"label": "Public",
"desc": "Partagé avec tous les utilisateurs"
},
"groups": {
"label": "Spécifier les groupes",
"desc": "Partagé uniquement avec les membres des groupes sélectionnés"
},
"sameAsAccessScope": {
"label": "Même portée que l'accès à la page",
"desc": "Partagé avec la même portée que l'accès à la page"
}
}
},
"link_edit": {
"edit_link": "Modifier lien",
"set_link_and_label": "Ajouter lien et étiquette",
Expand Down
32 changes: 32 additions & 0 deletions apps/app/public/static/locales/ja_JP/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
"Page Tree": "ページツリー",
"Bookmarks": "ブックマーク",
"In-App Notification": "通知",
"AI Assistant": "AI アシスタント",
"Knowledge Assistant": "ナレッジアシスタント",
"original_path": "元のパス",
"new_path": "新しいパス",
"duplicated_path": "重複したパス",
Expand Down Expand Up @@ -533,6 +535,36 @@
"error_message": "エラーが発生しました",
"show_error_detail": "詳細を表示"
},
"modal_ai_assistant": {
"default_instruction": "あなたはこのWikiの知識アシスタントです。以下の方針で支援を行ってください:\n\n- 文書の関連性分析と情報の関連付け\n- 新しい視点の提案\n- 質問の意図を理解した的確な情報提供 必要に応じて構造化された形式で情報を提供します。",
"page_mode_title": {
"share": "アシスタントの共有",
"pages": "参照ページ",
"instruction": "アシスタントへの指示"
},
"access_scope": {
"owner": "{{username}} がアクセス可能な全てのページ",
"groups": "グループを指定",
"publicOnly": "公開ページのみ"
},
"share_scope": {
"owner": {
"label": "{{username}} のみ"
},
"publicOnly": {
"label": "全体公開",
"desc": "すべてのユーザーに共有されます"
},
"groups": {
"label": "グループを指定",
"desc": "選択したグループのメンバーにのみ共有されます"
},
"sameAsAccessScope": {
"label": "ページのアクセス権限と同じ範囲",
"desc": "ページのアクセス権限と同じ範囲で共有されます"
}
}
},
"link_edit": {
"edit_link": "リンク編集",
"set_link_and_label": "リンク情報",
Expand Down
32 changes: 32 additions & 0 deletions apps/app/public/static/locales/zh_CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
"Page Tree": "页面树",
"Bookmarks": "书签",
"In-App Notification": "通知",
"AI Assistant": "AI助手",
"Knowledge Assistant": "知识助手",
"original_path": "Original path",
"new_path": "New path",
"duplicated_path": "Duplicated path",
Expand Down Expand Up @@ -489,6 +491,36 @@
"error_message": "错误",
"show_error_detail": "显示详情"
},
"modal_ai_assistant": {
"default_instruction": "您是这个Wiki的知识助手。请按照以下方针提供支持:\n\n- 分析文档相关性并连接信息\n- 提出新的观点\n- 理解问题意图并提供准确信息\n必要时我会以结构化的形式提供信息。",
"page_mode_title": {
"share": "助理共享",
"pages": "参考页面",
"instruction": "助理指示"
},
"access_scope": {
"owner": "{{username}} 可访问的所有页面",
"groups": "指定群组",
"publicOnly": "仅公开页面"
},
"share_scope": {
"owner": {
"label": "仅 {{ username }}"
},
"publicOnly": {
"label": "公开",
"desc": "与所有用户共享"
},
"groups": {
"label": "指定群组",
"desc": "仅与选定组的成员共享"
},
"sameAsAccessScope": {
"label": "与页面访问范围相同",
"desc": "与页面访问范围相同的范围共享"
}
}
},
"link_edit": {
"edit_link": "Edit Link",
"set_link_and_label": "Set link and label",
Expand Down
25 changes: 19 additions & 6 deletions apps/app/src/client/components/PageHeader/PagePathHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
useState, useCallback, memo,
} from 'react';

import nodePath from 'path';

import type { IPagePopulatedToShowRevision } from '@growi/core';
import { DevidedPagePath } from '@growi/core/dist/models';
import { normalizePath } from '@growi/core/dist/utils/path-utils';
Expand All @@ -11,13 +13,13 @@ import { debounce } from 'throttle-debounce';

import type { InputValidationResult } from '~/client/util/use-input-validator';
import { ValidationTarget, useInputValidator } from '~/client/util/use-input-validator';
import type { IPageForItem } from '~/interfaces/page';
import LinkedPagePath from '~/models/linked-page-path';
import { usePageSelectModal } from '~/stores/modal';

import { PagePathHierarchicalLink } from '../../../components/Common/PagePathHierarchicalLink';
import { AutosizeSubmittableInput, getAdjustedMaxWidthForAutosizeInput } from '../Common/SubmittableInput';
import { usePagePathRenameHandler } from '../PageEditor/page-path-rename-utils';
import { PageSelectModal } from '../PageSelectModal/PageSelectModal';

import styles from './PagePathHeader.module.scss';

Expand Down Expand Up @@ -45,8 +47,7 @@ export const PagePathHeader = memo((props: Props): JSX.Element => {
const [isRenameInputShown, setRenameInputShown] = useState(false);
const [isHover, setHover] = useState(false);

const { data: PageSelectModalData, open: openPageSelectModal } = usePageSelectModal();
const isOpened = PageSelectModalData?.isOpened ?? false;
const { open: openPageSelectModal } = usePageSelectModal();

const [validationResult, setValidationResult] = useState<InputValidationResult>();

Expand All @@ -61,6 +62,20 @@ export const PagePathHeader = memo((props: Props): JSX.Element => {

const pagePathRenameHandler = usePagePathRenameHandler(currentPage);

const onClickOpenPageSelectModalButton = useCallback(() => {
const onSelected = (page: IPageForItem): void => {
if (page == null || page.path == null) {
return;
}

const currentPageTitle = nodePath.basename(currentPage?.path ?? '') || '/';
const newPagePath = nodePath.resolve(page.path, currentPageTitle);

pagePathRenameHandler(newPagePath);
};

openPageSelectModal({ onSelected });
}, [currentPage?.path, openPageSelectModal, pagePathRenameHandler]);

const rename = useCallback((inputText) => {
const pathToRename = normalizePath(`${inputText}/${dPagePath.latter}`);
Expand Down Expand Up @@ -144,13 +159,11 @@ export const PagePathHeader = memo((props: Props): JSX.Element => {
<button
type="button"
className="btn btn-outline-neutral-secondary d-flex align-items-center justify-content-center"
onClick={openPageSelectModal}
onClick={onClickOpenPageSelectModalButton}
>
<span className="material-symbols-outlined fs-6">account_tree</span>
</button>
</div>

{isOpened && <PageSelectModal />}
</div>
);
});
78 changes: 52 additions & 26 deletions apps/app/src/client/components/PageSelectModal/PageSelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,71 +19,62 @@ import { useSWRxCurrentPage } from '~/stores/page';

import { ItemsTree } from '../ItemsTree';
import ItemsTreeContentSkeleton from '../ItemsTree/ItemsTreeContentSkeleton';
import { usePagePathRenameHandler } from '../PageEditor/page-path-rename-utils';

import { TreeItemForModal } from './TreeItemForModal';


export const PageSelectModal: FC = () => {
const PageSelectModalSubstance: FC = () => {
const {
data: PageSelectModalData,
close: closeModal,
} = usePageSelectModal();

const isOpened = PageSelectModalData?.isOpened ?? false;

const [clickedParentPagePath, setClickedParentPagePath] = useState<string | null>(null);
const [clickedParentPage, setClickedParentPage] = useState<IPageForItem | null>(null);
const [isIncludeSubPage, setIsIncludeSubPage] = useState(true);

const { t } = useTranslation();

const { data: isGuestUser } = useIsGuestUser();
const { data: isReadOnlyUser } = useIsReadOnlyUser();
const { data: currentPage } = useSWRxCurrentPage();
const { data: pageSelectModalData } = usePageSelectModal();

const pagePathRenameHandler = usePagePathRenameHandler(currentPage);
const isHierarchicalSelectionMode = pageSelectModalData?.opts?.isHierarchicalSelectionMode ?? false;

const onClickTreeItem = useCallback((page: IPageForItem) => {
const parentPagePath = page.path;

if (parentPagePath == null) {
return <></>;
return;
}

setClickedParentPagePath(parentPagePath);
setClickedParentPage(page);
}, []);

const onClickCancel = useCallback(() => {
setClickedParentPagePath(null);
setClickedParentPage(null);
closeModal();
}, [closeModal]);

const onClickDone = useCallback(() => {
if (clickedParentPagePath != null) {
const currentPageTitle = nodePath.basename(currentPage?.path ?? '') || '/';
const newPagePath = nodePath.resolve(clickedParentPagePath, currentPageTitle);

pagePathRenameHandler(newPagePath);
if (clickedParentPage != null) {
PageSelectModalData?.opts?.onSelected?.(clickedParentPage, isIncludeSubPage);
}

closeModal();
}, [clickedParentPagePath, closeModal, currentPage?.path, pagePathRenameHandler]);
}, [PageSelectModalData?.opts, clickedParentPage, closeModal, isIncludeSubPage]);

const parentPagePath = pathUtils.addTrailingSlash(nodePath.dirname(currentPage?.path ?? ''));

const targetPathOrId = clickedParentPagePath || parentPagePath;
const targetPathOrId = clickedParentPage?.path || parentPagePath;

const targetPath = clickedParentPagePath || parentPagePath;
const targetPath = clickedParentPage?.path || parentPagePath;

if (isGuestUser == null) {
return <></>;
}

return (
<Modal
isOpen={isOpened}
toggle={closeModal}
centered
>
<>
<ModalHeader toggle={closeModal}>{t('page_select_modal.select_page_location')}</ModalHeader>
<ModalBody className="p-0">
<Suspense fallback={<ItemsTreeContentSkeleton />}>
Expand All @@ -101,10 +92,45 @@ export const PageSelectModal: FC = () => {
</SimpleBar>
</Suspense>
</ModalBody>
<ModalFooter>
<Button color="secondary" onClick={onClickCancel}>{t('Cancel')}</Button>
<Button color="primary" onClick={onClickDone}>{t('Done')}</Button>
<ModalFooter className="border-top d-flex flex-column">
{ isHierarchicalSelectionMode && (
<div className="form-check form-check-info align-self-start ms-4">
<input
type="checkbox"
id="includeSubPages"
className="form-check-input"
name="fileUpload"
checked={isIncludeSubPage}
onChange={() => setIsIncludeSubPage(!isIncludeSubPage)}
/>
<label
className="form-label form-check-label"
htmlFor="includeSubPages"
>
{t('Include Subordinated Page')}
</label>
</div>
)}
<div className="d-flex gap-2 align-self-end">
<Button color="secondary" onClick={onClickCancel}>{t('Cancel')}</Button>
<Button color="primary" onClick={onClickDone}>{t('Done')}</Button>
</div>
</ModalFooter>
</>
);
};

export const PageSelectModal = (): JSX.Element => {
const { data: pageSelectModalData, close: closePageSelectModal } = usePageSelectModal();
const isOpen = pageSelectModalData?.isOpened ?? false;

if (!isOpen) {
return <></>;
}

return (
<Modal isOpen={isOpen} toggle={closePageSelectModal} centered>
<PageSelectModalSubstance />
</Modal>
);
};
Loading
Loading