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

Release v7.1.2 #9399

Merged
merged 57 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
39d988f
Add Swagger doc to /_api/v3/admin-home/
Oct 31, 2024
17282e8
Add swagger doc to app-settings.js
Nov 1, 2024
fa7049b
description修正
Nov 5, 2024
80f56bb
Add Cookie auth
Nov 5, 2024
9315842
Add Security schema
Nov 5, 2024
37b1bc1
Add AdminHome to definition-apiv3.js
Nov 5, 2024
7fdc289
Add security data
Nov 5, 2024
23dde87
コンフリクトを起こします
Ryosei-Fukushima Nov 7, 2024
4c4c707
Bump version
Nov 12, 2024
451ae2f
Merge pull request #9398 from weseek/support/prepare-v7.1.2-RC.0
mergify[bot] Nov 12, 2024
78af624
Add badger illust
satof3 Nov 13, 2024
7fbbe89
Fix light image
satof3 Nov 13, 2024
94951ad
upgrade @growi/*
yuki-takei Nov 13, 2024
adacf37
fix version-subpackages script
yuki-takei Nov 13, 2024
44321d1
Merge pull request #9401 from weseek/support/upgrade-growi-scope-pack…
mergify[bot] Nov 13, 2024
ba609c2
Merge branch 'master' into support/157164-add-badger-illust-in-huffle…
satof3 Nov 14, 2024
1a50dcc
add message no_unread_messages
Ryosei-Fukushima Nov 14, 2024
37484d0
Merge pull request #9403 from weseek/support/157164-add-badger-illust…
yuki-takei Nov 14, 2024
9f494b2
Merge pull request #9405 from weseek/fix/157375-add-no-unread-messages
mergify[bot] Nov 14, 2024
ab5a111
improve instructions
yuki-takei Nov 14, 2024
57962d7
Merge pull request #9407 from weseek/imprv/knowledge-assistant-instru…
mergify[bot] Nov 14, 2024
a675171
add @types/bunyan
yuki-takei Nov 14, 2024
3395ae8
Fix parameters description
Nov 15, 2024
816038b
Add default security
Nov 15, 2024
dec3bbe
Change type session to apiKey
Nov 15, 2024
74d5626
Update /app-settings/v5-schema-migration to send empty body
Nov 15, 2024
554d0ad
change default value
yuki-takei Nov 15, 2024
08c2f41
allows to configure the model by env var
yuki-takei Nov 15, 2024
d33daee
omit OPENAI_ASSISTANT_NAME_SUFFIX
yuki-takei Nov 15, 2024
b1fb542
Impl sanitizeMarkdownForVectorStoreFile
miya Nov 15, 2024
4d59d78
sanitize-markdown-for-vector-store-file -> sanitize-markdown
miya Nov 15, 2024
8e9c5f5
BugFix
yuki-takei Nov 15, 2024
6fe56ad
revert default value
yuki-takei Nov 15, 2024
293aa60
Merge pull request #9410 from weseek/imprv/knowedge-assistant-model-s…
mergify[bot] Nov 15, 2024
9ada2fe
add isAiEnabled to get config value
yuki-takei Nov 15, 2024
90fa996
refactor barrel file
yuki-takei Nov 15, 2024
e4a25bb
setup router dynamically
yuki-takei Nov 15, 2024
991464c
refactor starting cron services
yuki-takei Nov 15, 2024
2c96011
import openai modules dynamically in page operation
yuki-takei Nov 15, 2024
218337a
revert function declaration
yuki-takei Nov 15, 2024
a742de9
create thead before the first post
yuki-takei Nov 15, 2024
b5df52c
Merge pull request #9414 from weseek/imprv/threads-creation
mergify[bot] Nov 15, 2024
03c0a0d
run CI for app development on pull_request event
yuki-takei Nov 15, 2024
28982d0
Merge pull request #9340 from goofmint/features/swagger-admin-home
yuki-takei Nov 15, 2024
ae126eb
Merge pull request #9360 from goofmint/features/update_swagger_base_v3
yuki-takei Nov 15, 2024
c514f40
Merge pull request #9346 from goofmint/features/swagger-app-settings
yuki-takei Nov 15, 2024
9d06416
Use remark
miya Nov 16, 2024
67c8fe7
Add awati
miya Nov 16, 2024
cc31c71
Change replacement string
miya Nov 17, 2024
1feba06
Performance improvement of dynamic import
miya Nov 17, 2024
0ac74ca
Merge pull request #9413 from weseek/support/import-openai-features-d…
mergify[bot] Nov 18, 2024
25a1bec
Merge pull request #9411 from weseek/feat/157516-remove-unnecessary-s…
mergify[bot] Nov 18, 2024
b6eedb5
update DAYS_UNTIL_EXPIRATION
yuki-takei Nov 18, 2024
af66e0c
update cron interval for fractional sleep
yuki-takei Nov 18, 2024
bb5315b
refactor
yuki-takei Nov 18, 2024
43930d1
add normalize script
yuki-takei Nov 18, 2024
8e2fa75
Merge pull request #9419 from weseek/imprv/shorten-thread-deletion-ex…
mergify[bot] Nov 18, 2024
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
Prev Previous commit
Next Next commit
add normalize script
yuki-takei committed Nov 18, 2024

Verified

This commit was signed with the committer’s verified signature.
CristhianF7 Cristhian Fernández
commit 43930d1e2e091768f937a3c038c359f3bbcd62a0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './normalize-thread-relation-expired-at';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './normalize-thread-relation-expired-at';
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { faker } from '@faker-js/faker';
import { addDays, subDays } from 'date-fns';
import { Types } from 'mongoose';

import ThreadRelation from '../../../models/thread-relation';

import { MAX_DAYS_UNTIL_EXPIRATION, normalizeExpiredAtForThreadRelations } from './normalize-thread-relation-expired-at';

describe('normalizeExpiredAtForThreadRelations', () => {

it('should update expiredAt to 3 days from now for expired thread relations', async() => {
// arrange
const expiredDays = faker.number.int({ min: MAX_DAYS_UNTIL_EXPIRATION, max: 30 });
const expiredDate = addDays(new Date(), expiredDays);
const threadRelation = new ThreadRelation({
userId: new Types.ObjectId(),
threadId: 'test-thread',
expiredAt: expiredDate,
});
await threadRelation.save();

// act
await normalizeExpiredAtForThreadRelations();

// assert
const updatedThreadRelation = await ThreadRelation.findById(threadRelation._id);
expect(updatedThreadRelation).not.toBeNull();
assert(updatedThreadRelation?.expiredAt != null);
expect(updatedThreadRelation.expiredAt < addDays(new Date(), MAX_DAYS_UNTIL_EXPIRATION)).toBeTruthy();
});

it('should not update expiredAt for non-expired thread relations', async() => {
// arrange
const nonExpiredDays = faker.number.int({ min: 0, max: MAX_DAYS_UNTIL_EXPIRATION });
const nonExpiredDate = addDays(new Date(), nonExpiredDays);
const threadRelation = new ThreadRelation({
userId: new Types.ObjectId(),
threadId: 'test-thread-2',
expiredAt: nonExpiredDate,
});
await threadRelation.save();

// act
await normalizeExpiredAtForThreadRelations();

// assert
const updatedThreadRelation = await ThreadRelation.findById(threadRelation._id);
expect(updatedThreadRelation).not.toBeNull();
expect(updatedThreadRelation?.expiredAt).toEqual(nonExpiredDate);
});

it('should not update expiredAt is before today', async() => {
// arrange
const nonExpiredDate = subDays(new Date(), 1);
const threadRelation = new ThreadRelation({
userId: new Types.ObjectId(),
threadId: 'test-thread-3',
expiredAt: nonExpiredDate,
});
await threadRelation.save();

// act
await normalizeExpiredAtForThreadRelations();

// assert
const updatedThreadRelation = await ThreadRelation.findById(threadRelation._id);
expect(updatedThreadRelation).not.toBeNull();
expect(updatedThreadRelation?.expiredAt).toEqual(nonExpiredDate);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { addDays } from 'date-fns';

import ThreadRelation from '../../../models/thread-relation';

export const MAX_DAYS_UNTIL_EXPIRATION = 3;

export const normalizeExpiredAtForThreadRelations = async(): Promise<void> => {
const maxDaysExpiredAt = addDays(new Date(), MAX_DAYS_UNTIL_EXPIRATION);

await ThreadRelation.updateMany(
{ expiredAt: { $gt: maxDaysExpiredAt } },
{ $set: { expiredAt: maxDaysExpiredAt } },
);
};
2 changes: 2 additions & 0 deletions apps/app/src/server/service/normalize-data/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { normalizeExpiredAtForThreadRelations } from '~/features/openai/server/services/normalize-data';
import loggerFactory from '~/utils/logger';

import { convertRevisionPageIdToObjectId } from './convert-revision-page-id-to-objectid';
@@ -8,6 +9,7 @@ const logger = loggerFactory('growi:service:NormalizeData');
export const normalizeData = async(): Promise<void> => {
await renameDuplicateRootPages();
await convertRevisionPageIdToObjectId();
await normalizeExpiredAtForThreadRelations();

logger.info('normalizeData has been executed');
return;

Unchanged files with check annotations Beta

effects: Effects,
ok: State
): (
code: import('micromark-util-types').Code

Check warning on line 9 in packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.d.ts

GitHub Actions / ci-app-lint (20.x)

`import()` type annotations are forbidden

Check warning on line 9 in packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.d.ts

GitHub Actions / ci-app-lint (20.x)

`import()` type annotations are forbidden
) => void | import('micromark-util-types').State

Check warning on line 10 in packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.d.ts

GitHub Actions / ci-app-lint (20.x)

`import()` type annotations are forbidden

Check warning on line 10 in packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.d.ts

GitHub Actions / ci-app-lint (20.x)

`import()` type annotations are forbidden
export type Effects = import('micromark-util-types').Effects

Check warning on line 11 in packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.d.ts

GitHub Actions / ci-app-lint (20.x)

`import()` type annotations are forbidden

Check warning on line 11 in packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.d.ts

GitHub Actions / ci-app-lint (20.x)

`import()` type annotations are forbidden
export type State = import('micromark-util-types').State

Check warning on line 12 in packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.d.ts

GitHub Actions / ci-app-lint (20.x)

`import()` type annotations are forbidden

Check warning on line 12 in packages/remark-growi-directive/src/micromark-factory-attributes-devider/index.d.ts

GitHub Actions / ci-app-lint (20.x)

`import()` type annotations are forbidden
import type { AuthorizeResult } from '@slack/oauth';
import { InteractionPayloadAccessor } from '../utils/interaction-payload-accessor';

Check warning on line 3 in packages/slack/src/interfaces/growi-interaction-processor.ts

GitHub Actions / ci-app-lint (20.x)

All imports in the declaration are only used as types. Use `import type`

Check warning on line 3 in packages/slack/src/interfaces/growi-interaction-processor.ts

GitHub Actions / ci-app-lint (20.x)

All imports in the declaration are only used as types. Use `import type`
export interface InteractionHandledResult<V> {
shouldHandleInteraction(interactionPayloadAccessor: InteractionPayloadAccessor): boolean;
processInteraction(
authorizeResult: AuthorizeResult, interactionPayload: any, interactionPayloadAccessor: InteractionPayloadAccessor): Promise<InteractionHandledResult<V>>;

Check warning on line 16 in packages/slack/src/interfaces/growi-interaction-processor.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type

Check warning on line 16 in packages/slack/src/interfaces/growi-interaction-processor.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type
}
import type { Request } from 'express';
export interface IInteractionPayloadAccessor {
firstAction(): any;

Check warning on line 4 in packages/slack/src/interfaces/request-from-slack.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type

Check warning on line 4 in packages/slack/src/interfaces/request-from-slack.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type
}
export type RequestFromSlack = Request & {
// appended by GROWI or slackbot-proxy
slackSigningSecret?:string,
interactionPayload?: any,

Check warning on line 14 in packages/slack/src/interfaces/request-from-slack.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type

Check warning on line 14 in packages/slack/src/interfaces/request-from-slack.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type
interactionPayloadAccessor?: any,

Check warning on line 15 in packages/slack/src/interfaces/request-from-slack.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type

Check warning on line 15 in packages/slack/src/interfaces/request-from-slack.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type
};
import { InteractionPayloadAccessor } from '../utils/interaction-payload-accessor';
export const parseSlackInteractionRequest = (req: RequestFromSlack, res: Response, next: NextFunction): Record<string, any> | void => {

Check warning on line 7 in packages/slack/src/middlewares/parse-slack-interaction-request.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type

Check warning on line 7 in packages/slack/src/middlewares/parse-slack-interaction-request.ts

GitHub Actions / ci-app-lint (20.x)

Unexpected any. Specify a different type
// There is no payload in the request from slack
if (req.body.payload == null) {
return next();