refactor(services/tasks): Swtich to dify_config witch Pydantic (#6203)
This commit is contained in:
@@ -4,8 +4,8 @@ import time
|
||||
|
||||
import click
|
||||
from celery import shared_task
|
||||
from flask import current_app
|
||||
|
||||
from configs import dify_config
|
||||
from core.indexing_runner import DocumentIsPausedException, IndexingRunner
|
||||
from extensions.ext_database import db
|
||||
from models.dataset import Dataset, Document
|
||||
@@ -32,7 +32,7 @@ def document_indexing_task(dataset_id: str, document_ids: list):
|
||||
if features.billing.enabled:
|
||||
vector_space = features.vector_space
|
||||
count = len(document_ids)
|
||||
batch_upload_limit = int(current_app.config['BATCH_UPLOAD_LIMIT'])
|
||||
batch_upload_limit = int(dify_config.BATCH_UPLOAD_LIMIT)
|
||||
if count > batch_upload_limit:
|
||||
raise ValueError(f"You have reached the batch upload limit of {batch_upload_limit}.")
|
||||
if 0 < vector_space.limit <= vector_space.size:
|
||||
|
@@ -4,8 +4,8 @@ import time
|
||||
|
||||
import click
|
||||
from celery import shared_task
|
||||
from flask import current_app
|
||||
|
||||
from configs import dify_config
|
||||
from core.indexing_runner import DocumentIsPausedException, IndexingRunner
|
||||
from core.rag.index_processor.index_processor_factory import IndexProcessorFactory
|
||||
from extensions.ext_database import db
|
||||
@@ -33,7 +33,7 @@ def duplicate_document_indexing_task(dataset_id: str, document_ids: list):
|
||||
if features.billing.enabled:
|
||||
vector_space = features.vector_space
|
||||
count = len(document_ids)
|
||||
batch_upload_limit = int(current_app.config['BATCH_UPLOAD_LIMIT'])
|
||||
batch_upload_limit = int(dify_config.BATCH_UPLOAD_LIMIT)
|
||||
if count > batch_upload_limit:
|
||||
raise ValueError(f"You have reached the batch upload limit of {batch_upload_limit}.")
|
||||
if 0 < vector_space.limit <= vector_space.size:
|
||||
|
@@ -3,8 +3,9 @@ import time
|
||||
|
||||
import click
|
||||
from celery import shared_task
|
||||
from flask import current_app, render_template
|
||||
from flask import render_template
|
||||
|
||||
from configs import dify_config
|
||||
from extensions.ext_mail import mail
|
||||
|
||||
|
||||
@@ -29,7 +30,7 @@ def send_invite_member_mail_task(language: str, to: str, token: str, inviter_nam
|
||||
|
||||
# send invite member mail using different languages
|
||||
try:
|
||||
url = f'{current_app.config.get("CONSOLE_WEB_URL")}/activate?token={token}'
|
||||
url = f'{dify_config.CONSOLE_WEB_URL}/activate?token={token}'
|
||||
if language == 'zh-Hans':
|
||||
html_content = render_template('invite_member_mail_template_zh-CN.html',
|
||||
to=to,
|
||||
|
@@ -3,8 +3,9 @@ import time
|
||||
|
||||
import click
|
||||
from celery import shared_task
|
||||
from flask import current_app, render_template
|
||||
from flask import render_template
|
||||
|
||||
from configs import dify_config
|
||||
from extensions.ext_mail import mail
|
||||
|
||||
|
||||
@@ -24,7 +25,7 @@ def send_reset_password_mail_task(language: str, to: str, token: str):
|
||||
|
||||
# send reset password mail using different languages
|
||||
try:
|
||||
url = f'{current_app.config.get("CONSOLE_WEB_URL")}/forgot-password?token={token}'
|
||||
url = f'{dify_config.CONSOLE_WEB_URL}/forgot-password?token={token}'
|
||||
if language == 'zh-Hans':
|
||||
html_content = render_template('reset_password_mail_template_zh-CN.html',
|
||||
to=to,
|
||||
|
Reference in New Issue
Block a user