File size: 694 Bytes
ca93e90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from langchain_core.messages import AIMessage
from utils.inference import call_model

def run(state):
    html = state["html_output"]
    iteration = state["iteration"]

    prompt = f"""You are a QA engineer. Review the following HTML code:

{html}

Evaluate the UI for:
1. Visual quality
2. Responsiveness
3. Code correctness
4. Functional completeness

If it is perfect, reply only with 'APPROVED'.
If not, list clear improvements required."""
    output = call_model(prompt)
    done = "APPROVED" in output.upper()
    return {
        "messages": state["messages"] + [AIMessage(content=output)],
        "qa_feedback": output,
        "iteration": iteration + 1,
        "done": done
    }