Skip to content

Commit

Permalink
Merge branch 'feat/growi-ai-next' into feat/159153-implement-ai-assis…
Browse files Browse the repository at this point in the history
…tant-creation-api
  • Loading branch information
miya committed Dec 27, 2024
2 parents e8d1667 + 69a5165 commit 744f588
Show file tree
Hide file tree
Showing 26 changed files with 774 additions and 229 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
# Changelog

## [Unreleased](https://github.com/weseek/growi/compare/v7.1.5...HEAD)
## [Unreleased](https://github.com/weseek/growi/compare/v7.1.6...HEAD)

*Please do not manually update this file. We've automated the process.*

## [v7.1.6](https://github.com/weseek/growi/compare/v7.1.5...v7.1.6) - 2024-12-26

### 💎 Features

* feat(ai): Save file to VectorStore in HTML format (#9462) @miya

### 🐛 Bug Fixes

* fix: remark-lsx pagination (#9513) @miya
* fix: Spelling miss of external_link in i18n (#9456) @reiji-h
* fix: Wider copy to clipboard area (#9450) @Ryosei-Fukushima
* fix: Error when creating pages with deep hierarchy (#9487) @reiji-h

### 🧰 Maintenance

* ci(deps): bump next from 14.2.13 to 14.2.15 (#9501) @dependabot

## [v7.1.5](https://github.com/weseek/growi/compare/v7.1.4...v7.1.5) - 2024-12-13

### 🚀 Improvement
Expand Down
6 changes: 4 additions & 2 deletions apps/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@growi/app",
"version": "7.1.6-RC.0",
"version": "7.1.7-RC.0",
"license": "MIT",
"private": "true",
"scripts": {
Expand Down Expand Up @@ -157,7 +157,7 @@
"multer": "~1.4.0",
"multer-autoreap": "^1.0.3",
"mustache": "^4.2.0",
"next": "^14.2.13",
"next": "^14.2.15",
"next-dynamic-loading-props": "^0.1.1",
"next-i18next": "^15.3.1",
"next-superjson": "^0.0.4",
Expand Down Expand Up @@ -197,9 +197,11 @@
"reconnecting-websocket": "^4.4.0",
"redis": "^3.0.2",
"rehype-katex": "^7.0.1",
"rehype-meta": "^4.0.1",
"rehype-raw": "^7.0.0",
"rehype-sanitize": "^6.0.0",
"rehype-slug": "^6.0.0",
"rehype-stringify": "^10.0.1",
"rehype-toc": "^3.0.2",
"remark-breaks": "^4.0.0",
"remark-directive": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/app/public/static/locales/en_US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"Create under": "Create page under below:",
"V5 Page Migration": "Convert To V5 Compatibility",
"GROWI.5.0_new_schema": "GROWI.5.0 new schema",
"See_more_detail_on_new_schema": "See more detail on <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html#about-the-new-v5-compatible-format' target='_blank'>{{title}}</a> <span className='growi-custom-icons'>external_link</span> ",
"See_more_detail_on_new_schema": "See more detail on <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html#about-the-new-v5-compatible-format' target='_blank'>{{title}}</a> <span class='growi-custom-icons'>external_link</span> ",
"external_account_management": "External Account Management",
"UserGroup": "UserGroup",
"Basic Settings": "Basic Settings",
Expand Down Expand Up @@ -617,7 +617,7 @@
"alert_desc1": "On this page, you can select pages with the checkbox and batch convert to the new v5 compatible format from the \"Bulk operation\" button at the top of the screen.",
"nopages_title": "Congratulations. Ready to use GROWI v5!",
"nopages_desc1": "Now all the pages you can manage seem to be in v5 compatible format.",
"detail_info": "See the detail information from <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html' target='_blank' class='alert-link'>Upgrading GROWI to v5.0.x <span className='growi-custom-icons'>external_link</span></a>.",
"detail_info": "See the detail information from <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html' target='_blank' class='alert-link'>Upgrading GROWI to v5.0.x <span class='growi-custom-icons'>external_link</span></a>.",
"modal": {
"title": "Convert to new v5 compatible format",
"converting_pages": "Converting pages",
Expand Down
4 changes: 2 additions & 2 deletions apps/app/public/static/locales/fr_FR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"Create under": "Créer la page sous:",
"V5 Page Migration": "Convertir vers la V5",
"GROWI.5.0_new_schema": "Nouveau schéma GROWI.5.0",
"See_more_detail_on_new_schema": "Plus de détails sur <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html#about-the-new-v5-compatible-format' target='_blank'>{{title}}</a> <i class='icon-share-alt'></i> ",
"See_more_detail_on_new_schema": "Plus de détails sur <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html#about-the-new-v5-compatible-format' target='_blank'>{{title}}</a><span class='growi-custom-icons'>external_link</span> ",
"external_account_management": "Gestion des comptes externes",
"UserGroup": "Groupe utilisateur",
"Basic Settings": "Paramètres de base",
Expand Down Expand Up @@ -610,7 +610,7 @@
"alert_desc1": "Sélectionner les pages à convertir vers le format V5 avec le bouton \"Opération de masse\".",
"nopages_title": "GROWI V5 est maintenant utilisable!",
"nopages_desc1": "Toutes les pages ont été converties au format V5.",
"detail_info": "Pour plus de détails, voir <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html' target='_blank' class='alert-link'>Convertir vers GROWI v5.0.x <span className='growi-custom-icons'>external_link</span></a>.",
"detail_info": "Pour plus de détails, voir <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html' target='_blank' class='alert-link'>Convertir vers GROWI v5.0.x <span class='growi-custom-icons'>external_link</span></a>.",
"modal": {
"title": "Convertir au format V5",
"converting_pages": "Conversion des pages",
Expand Down
4 changes: 2 additions & 2 deletions apps/app/public/static/locales/ja_JP/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"Create under": "ページを以下に作成",
"V5 Page Migration": "V5 互換形式 への変換",
"GROWI.5.0_new_schema": "GROWI.5.0における新スキーマについて",
"See_more_detail_on_new_schema": "詳しくは<a href='https://docs.growi.org/ja/admin-guide/upgrading/50x.html#新しい-v5-互換形式について' target='_blank'>{{title}}</a><span className='growi-custom-icons'>external_link</span>を参照ください。",
"See_more_detail_on_new_schema": "詳しくは<a href='https://docs.growi.org/ja/admin-guide/upgrading/50x.html#新しい-v5-互換形式について' target='_blank'>{{title}}</a><span class='growi-custom-icons'>external_link</span>を参照ください。",
"external_account_management": "外部アカウント管理",
"UserGroup": "グループ",
"Basic Settings": "基本設定",
Expand Down Expand Up @@ -649,7 +649,7 @@
"alert_desc1": "このページでは、チェックボックスでページを選択し、画面上部の「一括操作」ボタンから新しい v5 互換形式に一括変換できます。",
"nopages_title": "おめでとうございます。GROWI v5 を使う準備が完了しました!",
"nopages_desc1": "今あなたが管理可能なページはすべて v5 互換形式になっているようです。",
"detail_info": "詳しくは <a href='https://docs.growi.org/ja/admin-guide/upgrading/50x.html' target='_blank' class='alert-link'>GROWI v5.0.x へのアップグレード <span className='growi-custom-icons'>external_link</span></a> を参照ください。",
"detail_info": "詳しくは <a href='https://docs.growi.org/ja/admin-guide/upgrading/50x.html' target='_blank' class='alert-link'>GROWI v5.0.x へのアップグレード <span class='growi-custom-icons'>external_link</span></a> を参照ください。",
"modal": {
"title": "新しい v5 互換形式への変換",
"converting_pages": "以下のページを変換します",
Expand Down
4 changes: 2 additions & 2 deletions apps/app/public/static/locales/zh_CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"Create under": "Create page under below:",
"V5 Page Migration": "转换为V5的兼容性",
"GROWI.5.0_new_schema": "GROWI.5.0 new schema",
"See_more_detail_on_new_schema": "更多详情请见<a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html#about-the-new-v5-compatible-format' target='_blank'> {{title}}</a> <span className='growi-custom-icons'>external_link</span> ",
"See_more_detail_on_new_schema": "更多详情请见<a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html#about-the-new-v5-compatible-format' target='_blank'> {{title}}</a> <span class='growi-custom-icons'>external_link</span> ",
"Markdown Settings": "Markdown设置",
"external_account_management": "外部账户管理",
"UserGroup": "用户组",
Expand Down Expand Up @@ -619,7 +619,7 @@
"alert_desc1": "在这一页,你可以用复选框选择页面,并通过屏幕上方的批量操作按钮批量转换为新的v5兼容格式。",
"nopages_title": "恭喜你。准备使用GROWI v5!",
"nopages_desc1": "现在你能管理的所有页面似乎都是v5兼容的格式。",
"detail_info": "请参见 <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html' target='_blank' class='alert-link'>升级GROWI到v5.0.x <span className='growi-custom-icons'>external_link</span></a>.的详细内容。",
"detail_info": "请参见 <a href='https://docs.growi.org/en/admin-guide/upgrading/50x.html' target='_blank' class='alert-link'>升级GROWI到v5.0.x <span class='growi-custom-icons'>external_link</span></a>.的详细内容。",
"modal": {
"title": "转换为新的v5兼容格式",
"converting_pages": "转换页面",
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,72 +19,63 @@ 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: targetAndAncestorsData } = useTargetAndAncestors();
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 @@ -103,10 +94,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>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

.grw-page-path-nav-layout :global {
.grw-page-path-nav-copydropdown {
display: none;
visibility: hidden;
@include bs.media-breakpoint-down(md) {
display: block;
}
Expand All @@ -15,7 +15,7 @@
&:global {
&:hover {
.grw-page-path-nav-copydropdown {
display: block;
visibility: visible;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions apps/app/src/components/Layout/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const AiAssistantManegementModal = dynamic(
() => import('~/features/openai/client/components/AiAssistant/AiAssistantManegementModal')
.then(mod => mod.AiAssistantManegementModal), { ssr: false },
);
const PageSelectModal = dynamic(() => import('~/client/components/PageSelectModal/PageSelectModal').then(mod => mod.PageSelectModal), { ssr: false });

type Props = {
children?: ReactNode
Expand Down Expand Up @@ -70,6 +71,7 @@ export const BasicLayout = ({ children, className }: Props): JSX.Element => {
<DeleteAttachmentModal />
<DeleteBookmarkFolderModal />
<PutbackPageModal />
<PageSelectModal />
<SearchModal />
<AiChatModal />
<AiAssistantManegementModal />
Expand Down
Loading

0 comments on commit 744f588

Please sign in to comment.