fix: improve maintenance and synchronize live conversations

This commit is contained in:
WangShen007 committed 2026-10-29 09:46:21 +08:00
1 parent bb541bd212
commit ef86a5d3af
297 files changed
+2983 -1274

No files matched your search

+3 -1
View File
@@ -15,4 +15,6 @@ limitations under the License.
"""
from . import shopify_shop_repository
from . import agent_shopify_config_repository
from . import agent_shopify_config_repository
__all__ = ["shopify_shop_repository", "agent_shopify_config_repository"]
+1 -1
View File
@@ -16,7 +16,7 @@ limitations under the License.
from sqlalchemy.orm import Session
from typing import List, Optional
from app.models.agent import Agent, AgentType
from app.models.agent import Agent
import json
from sqlalchemy.orm import joinedload
from uuid import UUID
@@ -23,7 +23,7 @@ from app.models.schemas.shopify.agent_shopify_config import (
AgentShopifyConfigUpdate
)
from app.core.logger import get_logger
from sqlalchemy import cast, String
from sqlalchemy import String
logger = get_logger(__name__)
+1 -1
View File
@@ -16,7 +16,7 @@ limitations under the License.
from sqlalchemy.orm import Session
from app.models.ai_config import AIConfig, AIModelType, DEFAULT_AI_SETTINGS
from app.core.security import encrypt_api_key, decrypt_api_key
from app.core.security import encrypt_api_key
from typing import Optional
-1
View File
@@ -21,7 +21,6 @@ from app.models.chat_history import ChatHistory
from app.models.customer import Customer
from uuid import UUID
from sqlalchemy import func, or_, select, text, and_
from sqlalchemy.sql import case
from app.models.agent import Agent
from app.models.session_to_agent import SessionToAgent
from app.repositories.channels import ChannelConversationRepository
+1 -1
View File
@@ -56,7 +56,7 @@ class CustomerRepository:
).first()
return customer
except Exception as e:
logger.error(f"Error getting customer by email: {str(e)}")
logger.error(f"Error getting customer by email: {type(e).__name__}")
return None
def get_customer_by_phone(
+1 -2
View File
@@ -15,8 +15,7 @@ limitations under the License.
"""
from sqlalchemy.orm import Session, joinedload
from sqlalchemy import cast, String, func
from typing import Optional, Dict, Any
from typing import Optional
from app.models.jira import AgentJiraConfig
from app.models.agent import Agent
from uuid import UUID
+1 -1
View File
@@ -17,7 +17,7 @@ limitations under the License.
from sqlalchemy.orm import Session, joinedload
from typing import List, Optional
from app.models.agent import Agent
from app.models.mcp_tool import MCPTool, MCPToolToAgent, MCPTransportType
from app.models.mcp_tool import MCPTool, MCPToolToAgent
from app.models.ticket_settings import OrganizationTicketSettings
from uuid import UUID
from app.core.logger import get_logger
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
from typing import Iterable, List, Optional, Set
from typing import Iterable, Optional, Set
from uuid import UUID
from sqlalchemy.exc import IntegrityError
+2 -2
View File
@@ -15,9 +15,9 @@ limitations under the License.
"""
from sqlalchemy.orm import Session
from typing import List, Optional, Union
from typing import List, Optional
from app.models.role import Role
from app.models.permission import Permission, role_permissions
from app.models.permission import Permission
from app.models.user import User
from uuid import UUID
from app.core.logger import get_logger
+2 -4
View File
@@ -380,7 +380,6 @@ class SessionToAgentRepository:
logger.info(f"Updating workflow state for session {session_id}")
logger.info(f"Setting current_node_id to: {current_node_id}")
logger.info(f"Setting workflow_state to: {workflow_state}")
# Update fields
session.current_node_id = current_node_id
@@ -396,11 +395,10 @@ class SessionToAgentRepository:
# Verify the update
logger.info(f"Verified - current_node_id: {session.current_node_id}")
logger.info(f"Verified - workflow_state: {session.workflow_state}")
return True
except Exception as e:
logger.error(f"Error updating workflow state: {str(e)}")
logger.error(f"Error updating workflow state for session {session_id}: {type(e).__name__}")
self.db.rollback()
return False
@@ -477,7 +475,7 @@ class SessionToAgentRepository:
logger.info(f"Added workflow history entry for session {session_id}: {entry_type}")
return True
except Exception as e:
logger.error(f"Error adding workflow history entry: {str(e)}")
logger.error(f"Error adding workflow history for session {session_id} at node {node_id}: {type(e).__name__}")
self.db.rollback()
return False
-1
View File
@@ -28,7 +28,6 @@ from app.models.investigation import (
InvestigationHypothesis,
InvestigationRun,
InvestigationRunStatus,
InvestigationRunType,
RCADocument,
)
from app.models.ticket import (
+1 -4
View File
@@ -14,14 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
from typing import List, Optional, Dict, Any
from typing import List, Optional
from uuid import UUID
from sqlalchemy.orm import Session, selectinload
from sqlalchemy.exc import SQLAlchemyError
from app.models.workflow import Workflow, WorkflowStatus
from app.models.workflow_node import WorkflowNode
from app.models.workflow_connection import WorkflowConnection
from app.core.logger import get_logger