11import io
22import json
3- import logging
43import re
54import time
65import os
76from copy import deepcopy
87from dataclasses import dataclass , field
98from datetime import datetime , date , timedelta , timezone
109from email .utils import parseaddr
11- from queue import Full
1210from urllib .parse import unquote , urlparse , parse_qs
1311from uuid import UUID
1412from pathlib import Path
1513
1614from dtable_events .utils .dtable_ai_api import DTableAIAPI
17- import jwt
1815import requests
1916from dateutil import parser
2017from sqlalchemy import text
2118
2219from seaserv import seafile_api
2320from dtable_events .automations .models import get_third_party_account
2421from dtable_events .utils .utils_metadata_cache import clean_metadata , get_metadata
25- from dtable_events .app .event_redis import redis_cache
26- from dtable_events .app .config import DTABLE_WEB_SERVICE_URL , ENABLE_PYTHON_SCRIPT , INNER_SEATABLE_AI_SERVER_URL , SEATABLE_FAAS_URL , INNER_DTABLE_DB_URL , \
22+ from dtable_events .app .config import DTABLE_WEB_SERVICE_URL , INNER_DTABLE_WEB_SERVICE_URL , ENABLE_PYTHON_SCRIPT , INNER_SEATABLE_AI_SERVER_URL , SEATABLE_FAAS_URL , INNER_DTABLE_DB_URL , \
2723INNER_DTABLE_SERVER_URL , ENABLE_SEATABLE_AI , AUTO_RULES_AI_CONTENT_MAX_LENGTH
2824from dtable_events .dtable_io import send_wechat_msg , send_dingtalk_msg
2925from dtable_events .convert_page .manager import get_playwright_manager
3026from dtable_events .app .log import auto_rule_logger
3127from dtable_events .notification_rules .notification_rules_utils import send_notification , fill_msg_blanks_with_sql_row
3228from dtable_events .utils import uuid_str_to_36_chars , is_valid_email , \
33- normalize_file_path , gen_file_get_url , gen_random_option , get_dtable_admins , \
29+ normalize_file_path , gen_file_get_url , gen_random_option , \
3430 parse_docx , parse_pdf
3531from dtable_events .dtable_io .utils import gen_inner_file_get_url
3632from dtable_events .utils .constants import ColumnTypes , INVOICE_TYPES
@@ -830,7 +826,7 @@ def __init__(self, auto_rule, action_type, data, msg, users, users_column_key, a
830826
831827 self .column_blanks = []
832828 self .col_name_dict = {}
833- self .notice_api = UniversalAppAPI ('notification-rule' , app_uuid , DTABLE_WEB_SERVICE_URL )
829+ self .notice_api = UniversalAppAPI ('notification-rule' , app_uuid , INNER_DTABLE_WEB_SERVICE_URL )
834830
835831 self .init_notify (msg )
836832
@@ -1488,7 +1484,7 @@ def can_do_action(self):
14881484 if self .auto_rule .can_run_python is not None :
14891485 return self .auto_rule .can_run_python
14901486
1491- dtable_web_api = DTableWebAPI (DTABLE_WEB_SERVICE_URL )
1487+ dtable_web_api = DTableWebAPI (INNER_DTABLE_WEB_SERVICE_URL )
14921488 try :
14931489 if self .org_id != - 1 :
14941490 can_run_python = dtable_web_api .can_org_run_python (self .org_id )
@@ -1506,7 +1502,7 @@ def can_do_action(self):
15061502 def get_scripts_running_limit (self ):
15071503 if self .auto_rule .scripts_running_limit is not None :
15081504 return self .auto_rule .scripts_running_limit
1509- dtable_web_api = DTableWebAPI (DTABLE_WEB_SERVICE_URL )
1505+ dtable_web_api = DTableWebAPI (INNER_DTABLE_WEB_SERVICE_URL )
15101506 try :
15111507 if self .org_id != - 1 :
15121508 scripts_running_limit = dtable_web_api .get_org_scripts_running_limit (self .org_id )
@@ -1529,7 +1525,7 @@ def do_action(self):
15291525 scripts_running_limit = self .get_scripts_running_limit ()
15301526
15311527 # request faas url
1532- dtable_web_api = DTableWebAPI (DTABLE_WEB_SERVICE_URL )
1528+ dtable_web_api = DTableWebAPI (INNER_DTABLE_WEB_SERVICE_URL )
15331529 try :
15341530 dtable_web_api .run_script (
15351531 uuid_str_to_36_chars (self .auto_rule .dtable_uuid ),
@@ -2463,7 +2459,7 @@ def do_action(self):
24632459 auto_rule_logger .error ('rule: %s submit workflow: %s append row dtable: %s, error: %s' , self .auto_rule .rule_id , self .token , self .auto_rule .dtable_uuid , e )
24642460 return
24652461
2466- dtable_web_api = DTableWebAPI (DTABLE_WEB_SERVICE_URL )
2462+ dtable_web_api = DTableWebAPI (INNER_DTABLE_WEB_SERVICE_URL )
24672463 try :
24682464 dtable_web_api .internal_submit_row_workflow (self .token , row_id , self .auto_rule .rule_id )
24692465 except Exception as e :
@@ -4563,7 +4559,7 @@ def __init__(self, data, raw_trigger, raw_actions, options):
45634559
45644560 self .dtable_server_api = DTableServerAPI (self .username , str (UUID (self .dtable_uuid )), INNER_DTABLE_SERVER_URL )
45654561 self .dtable_db_api = DTableDBAPI (self .username , str (UUID (self .dtable_uuid )), INNER_DTABLE_DB_URL )
4566- self .dtable_web_api = DTableWebAPI (DTABLE_WEB_SERVICE_URL )
4562+ self .dtable_web_api = DTableWebAPI (INNER_DTABLE_WEB_SERVICE_URL )
45674563 self .seatable_ai_api = DTableAIAPI (self .username , self .org_id , self .dtable_uuid , INNER_SEATABLE_AI_SERVER_URL )
45684564
45694565 self .query_stats = []
0 commit comments