Skip to content

Commit 5e35c92

Browse files
committed
fix: update AZURE_OPENAI_API_VERSION to 2025-03-01-preview and apply lint fixes
- Update AZURE_OPENAI_API_VERSION from 2025-01-01-preview to 2025-03-01-preview in both main.bicep and main_custom.bicep - Fix ruff lint errors in backend-api (None comparison, unused variables) - Apply ruff formatting across processor and backend-api source files
1 parent b160519 commit 5e35c92

44 files changed

Lines changed: 414 additions & 374 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

infra/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ module appConfiguration 'br/public:avm/res/app-configuration/configuration-store
899899
}
900900
{
901901
name: 'AZURE_OPENAI_API_VERSION'
902-
value: '2025-01-01-preview'
902+
value: '2025-03-01-preview'
903903
}
904904
{
905905
name: 'AZURE_OPENAI_CHAT_DEPLOYMENT_NAME'

infra/main_custom.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ module appConfiguration 'br/public:avm/res/app-configuration/configuration-store
877877
}
878878
{
879879
name: 'AZURE_OPENAI_API_VERSION'
880-
value: '2025-01-01-preview'
880+
value: '2025-03-01-preview'
881881
}
882882
{
883883
name: 'AZURE_OPENAI_CHAT_DEPLOYMENT_NAME'

src/backend-api/src/app/libs/application/application_configuration.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ class Configuration(_configuration_base, KernelBaseSettings):
3434
app_sample_variable: str = Field(default="Hello World!")
3535

3636
# Azure logging configuration
37-
azure_package_logging_level: str = Field(default="WARNING", alias="AZURE_PACKAGE_LOGGING_LEVEL")
38-
azure_logging_packages: str | None = Field(default=None, alias="AZURE_LOGGING_PACKAGES")
37+
azure_package_logging_level: str = Field(
38+
default="WARNING", alias="AZURE_PACKAGE_LOGGING_LEVEL"
39+
)
40+
azure_logging_packages: str | None = Field(
41+
default=None, alias="AZURE_LOGGING_PACKAGES"
42+
)
3943

4044
global_llm_service: str | None = "AzureOpenAI"
4145
cosmos_db_process_log_container: str | None = Field(

src/backend-api/src/app/libs/base/application_base.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,20 @@ def __init__(self, env_file_path: str | None = None, **data):
6262

6363
# Configure Azure package logging levels only if packages are specified
6464
if self.application_context.configuration.azure_logging_packages:
65-
azure_level = getattr(logging, self.application_context.configuration.azure_package_logging_level.upper(), logging.WARNING)
66-
for logger_name in filter(None, (pkg.strip() for pkg in self.application_context.configuration.azure_logging_packages.split(','))):
65+
azure_level = getattr(
66+
logging,
67+
self.application_context.configuration.azure_package_logging_level.upper(),
68+
logging.WARNING,
69+
)
70+
for logger_name in filter(
71+
None,
72+
(
73+
pkg.strip()
74+
for pkg in self.application_context.configuration.azure_logging_packages.split(
75+
","
76+
)
77+
),
78+
):
6779
logging.getLogger(logger_name).setLevel(azure_level)
6880

6981
# Initialize the application

src/backend-api/src/app/libs/base/fastapi_protocol.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ class FastAPIWithContext(Protocol):
1616
app_context: AppContext
1717

1818
# Include essential FastAPI methods for type checking
19-
def include_router(self, *args, **kwargs) -> None:
20-
...
19+
def include_router(self, *args, **kwargs) -> None: ...
2120

2221

2322
def add_app_context_to_fastapi(

src/backend-api/src/app/libs/repositories/process_status_repository.py

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import asyncio
2+
from datetime import UTC, datetime
23
from typing import Any
34

4-
from sas.cosmosdb.sql.repository import RepositoryBase
5-
65
from routers.models.process_agent_activities import (
76
AgentStatus,
87
ProcessStatus,
98
ProcessStatusSnapshot,
109
)
11-
12-
from datetime import datetime, UTC
10+
from sas.cosmosdb.sql.repository import RepositoryBase
1311

1412

1513
def calculate_activity_duration(activity_start: str) -> tuple[int, str]:
@@ -142,7 +140,7 @@ async def get_process_status_by_process_id(
142140
)
143141

144142
status = await self.get_async(process_id)
145-
if status != None:
143+
if status is not None:
146144
return ProcessStatusSnapshot(
147145
process_id=status.id, # Fix: use process_id instead of id
148146
step=status.step,
@@ -305,26 +303,7 @@ async def render_agent_status(self, process_id: str) -> dict:
305303
formatted_lines = []
306304
agent_metrics = {}
307305

308-
# Check if process failed early (before agents really started working)
309306
process_failed = getattr(process_data, "status", "") == "failed"
310-
process_duration_seconds = 0
311-
if hasattr(process_data, "started_at_time") and hasattr(
312-
process_data, "last_update_time"
313-
):
314-
try:
315-
start = datetime.fromisoformat(
316-
process_data.started_at_time.replace(" UTC", "+00:00")
317-
)
318-
end = datetime.fromisoformat(
319-
process_data.last_update_time.replace(" UTC", "+00:00")
320-
)
321-
process_duration_seconds = int((end - start).total_seconds())
322-
except Exception:
323-
pass
324-
325-
early_failure = (
326-
process_failed and process_duration_seconds < 30
327-
) # Failed in less than 30 seconds
328307

329308
# Analyze each agent with enhanced insights
330309
for agent_name, agent_data in agents_data.items():
@@ -413,6 +392,23 @@ async def render_agent_status(self, process_id: str) -> dict:
413392
if is_active and duration_seconds > 30:
414393
message_parts.append(f"({duration_str})")
415394

395+
# Add tool usage from recent activity history
396+
recent_tools = []
397+
for h in activity_history[-5:]:
398+
tool = h.get("tool_used", "")
399+
if tool and tool not in recent_tools:
400+
recent_tools.append(tool)
401+
if recent_tools:
402+
tool_names = ", ".join(
403+
recent_tools[-3:]
404+
) # Show last 3 unique tools
405+
message_parts.append(f"🔧 {tool_names}")
406+
407+
# Add activity count
408+
total_activities = len(activity_history)
409+
if total_activities > 0:
410+
message_parts.append(f"📊 {total_activities} actions")
411+
416412
# Add relationship indicators
417413
if relationships["waiting_for"]:
418414
waiting_names = [
@@ -496,6 +492,25 @@ async def render_agent_status(self, process_id: str) -> dict:
496492
"bottleneck_score": total_blocking,
497493
"fast_agents": fast_agents,
498494
"failed_agents": failed_agents,
495+
# NEW: Structured agent activities for rich frontend display
496+
"agent_activities": agents_data,
497+
# NEW: Step timing data
498+
"step_timings": {
499+
k: v
500+
for k, v in (
501+
getattr(process_data, "step_timings", {}) or {}
502+
).items()
503+
},
504+
# NEW: Step results and metrics
505+
"step_results": {
506+
k: v
507+
for k, v in (
508+
getattr(process_data, "step_results", {}) or {}
509+
).items()
510+
},
511+
"generated_files": getattr(process_data, "generated_files", []) or [],
512+
"conversion_metrics": getattr(process_data, "conversion_metrics", {})
513+
or {},
499514
}
500515

501516
async def render_agent_status_old(self, process_id: str) -> dict:

src/backend-api/src/app/libs/services/interfaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Licensed under the MIT License.
33

44
from abc import ABC, abstractmethod
5-
from typing import Any, Dict, Union
5+
from typing import Any, Dict
66

77

88
class IDataService(ABC):

src/backend-api/src/app/routers/models/files.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from datetime import datetime, timezone
21
from pydantic import BaseModel, Field
32

43

src/backend-api/src/app/routers/router_files.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,14 @@
1313
)
1414
from fastapi.responses import Response
1515
from libs.base.typed_fastapi import TypedFastAPI
16-
from libs.models.entities import File, Process
16+
from libs.models.entities import File
1717
from libs.sas.storage import AsyncStorageBlobHelper
1818
from libs.services.auth import get_authenticated_user
1919
from libs.services.input_validation import is_valid_uuid
2020
from libs.services.interfaces import ILoggerService
21-
from libs.sas.storage import AsyncStorageBlobHelper
22-
from libs.models.entities import File, Process
2321
from routers.models.files import FileUploadResult
2422
from libs.repositories.process_repository import ProcessRepository
2523
from libs.repositories.file_repository import FileRepository
26-
from libs.repositories.process_repository import ProcessRepository
2724

2825
router = APIRouter(
2926
prefix="/api/file",

src/processor/.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv",
4343
"VIRTUAL_ENV": "/home/vscode/.venv"
4444
},
45-
"postCreateCommand": "uv sync --python 3.12 --prerelease=allow --link-mode=copy --frozen",
45+
"postCreateCommand": "uv sync --python 3.12 --link-mode=copy --frozen",
4646
"postStartCommand": "uv tool install pre-commit --with pre-commit-uv --force-reinstall",
4747
"remoteUser": "vscode"
4848
}

0 commit comments

Comments
 (0)