|
12 | 12 | from mcp.server.fastmcp import Context, FastMCP |
13 | 13 | from pydantic import ValidationError |
14 | 14 |
|
| 15 | +from mcp_as_a_judge.constants import MAX_CONTEXT_TOKENS |
15 | 16 | from mcp_as_a_judge.db.conversation_history_service import ConversationHistoryService |
16 | 17 | from mcp_as_a_judge.db.db_config import load_config |
17 | 18 | from mcp_as_a_judge.elicitation_provider import elicitation_provider |
|
48 | 49 | tool_description_provider, |
49 | 50 | ) |
50 | 51 |
|
51 | | -from src.mcp_as_a_judge.constants import MAX_CONTEXT_TOKENS |
52 | | - |
53 | 52 | # Initialize centralized logging |
54 | 53 | setup_logging() |
55 | 54 |
|
@@ -90,9 +89,16 @@ async def build_workflow( |
90 | 89 |
|
91 | 90 | try: |
92 | 91 | # STEP 1: Load conversation history and format as JSON array |
93 | | - conversation_history = await conversation_service.load_filtered_context_for_enrichment(session_id, json.dumps(original_input)) |
94 | | - history_json_array = conversation_service.format_conversation_history_as_json_array(conversation_history) |
95 | | - |
| 92 | + conversation_history = ( |
| 93 | + await conversation_service.load_filtered_context_for_enrichment( |
| 94 | + session_id, json.dumps(original_input) |
| 95 | + ) |
| 96 | + ) |
| 97 | + history_json_array = ( |
| 98 | + conversation_service.format_conversation_history_as_json_array( |
| 99 | + conversation_history |
| 100 | + ) |
| 101 | + ) |
96 | 102 |
|
97 | 103 | # STEP 2: Create system and user messages with separate context and conversation history |
98 | 104 | system_vars = WorkflowGuidanceSystemVars( |
@@ -135,7 +141,7 @@ async def build_workflow( |
135 | 141 | log_error(e, "build_workflow") |
136 | 142 | # Return a default workflow guidance in case of error |
137 | 143 | return WorkflowGuidance( |
138 | | - next_tool="elicit_missing_requirements", |
| 144 | + next_tool="raise_missing_requirements", |
139 | 145 | reasoning="An error occurred during workflow generation. Please provide more details.", |
140 | 146 | preparation_needed=[ |
141 | 147 | "Review the error and provide more specific requirements" |
@@ -558,9 +564,16 @@ async def judge_coding_plan( |
558 | 564 |
|
559 | 565 | try: |
560 | 566 | # STEP 1: Load conversation history and format as JSON array |
561 | | - conversation_history = await conversation_service.load_filtered_context_for_enrichment(session_id, json.dumps(original_input)) |
562 | | - history_json_array = conversation_service.format_conversation_history_as_json_array(conversation_history) |
563 | | - |
| 567 | + conversation_history = ( |
| 568 | + await conversation_service.load_filtered_context_for_enrichment( |
| 569 | + session_id, json.dumps(original_input) |
| 570 | + ) |
| 571 | + ) |
| 572 | + history_json_array = ( |
| 573 | + conversation_service.format_conversation_history_as_json_array( |
| 574 | + conversation_history |
| 575 | + ) |
| 576 | + ) |
564 | 577 |
|
565 | 578 | # STEP 2: Use helper function for main evaluation with JSON array conversation history |
566 | 579 | evaluation_result = await _evaluate_coding_plan( |
@@ -639,8 +652,16 @@ async def judge_code_change( |
639 | 652 |
|
640 | 653 | try: |
641 | 654 | # STEP 1: Load conversation history and format as JSON array |
642 | | - conversation_history = await conversation_service.load_filtered_context_for_enrichment(session_id,json.dumps(original_input)) |
643 | | - history_json_array = conversation_service.format_conversation_history_as_json_array(conversation_history) |
| 655 | + conversation_history = ( |
| 656 | + await conversation_service.load_filtered_context_for_enrichment( |
| 657 | + session_id, json.dumps(original_input) |
| 658 | + ) |
| 659 | + ) |
| 660 | + history_json_array = ( |
| 661 | + conversation_service.format_conversation_history_as_json_array( |
| 662 | + conversation_history |
| 663 | + ) |
| 664 | + ) |
644 | 665 |
|
645 | 666 | # STEP 2: Create system and user messages with separate context and conversation history |
646 | 667 | system_vars = JudgeCodeChangeSystemVars( |
|
0 commit comments