File size: 1,431 Bytes
5a2d62e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from base_agent import BaseAgent
from models import AgentState
from typing import AsyncGenerator
import json

class TimingDiagramGenerator(BaseAgent):
    async def __call__(self, state: AgentState) -> AsyncGenerator[str, None]:
        prompt_template = """
        Generate PlantUML code for a timing diagram based on the following project:

        Project: {project_name}
        Description: {project_description}
        Sequence: {sequence_interactions}

        Instructions:
        1. Show the timing constraints between components
        2. Include lifelines and state changes over time
        3. Use standard PlantUML timing diagram syntax
        4. Don't include any explanation, just the PlantUML code

        Example format (DO NOT TREAT THIS AS VARIABLES):
        '''plantuml
        @startuml
        clock "Clock" as C with period 1
        binary "Signal" as S
        @0
        S is low
        @5
        S is high
        @10
        S is low
        @enduml
        '''
        """

        async for chunk in self._stream_process(
            state=state,
            prompt_template=prompt_template,
            output_key="timing_diagram",
            step_name="generate_timing_diagram",
            project_name=state["project_name"],
            project_description=state["project_description"],
            sequence_interactions=state["sequence_interactions"]
        ):
            yield chunk