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: Automatic thread deletion using node-cron #9256

Conversation

miya
Copy link
Member

@miya miya commented Oct 17, 2024

Task

  • #155005 [RAG] 使われなくなった Thread が自動で削除される
    • #155763 thread が自動で削除できる

@miya miya requested a review from yuki-takei October 17, 2024 09:25
@miya miya self-assigned this Oct 17, 2024
Copy link

changeset-bot bot commented Oct 17, 2024

⚠️ No Changeset found

Latest commit: fb767d3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

apps/app/package.json Show resolved Hide resolved
this.openaiService = openaiService;

// Executed at 0 minutes of every hour
const cronSchedule = '0 * * * *';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一時間に一回実行

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

環境変数でカスタムできても良いかも

private async executeJob(): Promise<void> {
// Must be careful of OpenAI's rate limit
// Delete up to 100 threads per hour
await this.openaiService.deleteExpiredThreads(DELETE_LIMIT);
Copy link
Member Author

@miya miya Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • OpenAI の rate limit に考慮して最大100件まで thread を削除する
  • いっきに何千件も削除してしまった場合、メインのナレッジアシスタントに影響が出てしまう可能性があるため


}

export default ThreadDeletionCronService;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuki-takei
Copy link
Member

@mergify requeue

Copy link
Contributor

mergify bot commented Oct 18, 2024

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

mergify bot added a commit that referenced this pull request Oct 18, 2024
@mergify mergify bot merged commit cc279f4 into feat/155690-implement-openai-thread-model Oct 18, 2024
9 checks passed
@mergify mergify bot deleted the feat/155763-automatic-thread-deletion branch October 18, 2024 14:32
@github-actions github-actions bot mentioned this pull request Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants