Skip to content

Commit b94e08d

Browse files
committed
Fixed image extraction.
1 parent 802e6de commit b94e08d

7 files changed

Lines changed: 6 additions & 16 deletions

File tree

daiv/automation/agents/image_url_extractor/schemas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ImageTemplate(BaseModel):
2121

2222
@staticmethod
2323
def from_images(
24-
images: list[Image], repo_client_slug: str | None = None, project_id: int | None = None
24+
images: list[Image], repo_client_slug: ClientType | None = None, project_id: int | None = None
2525
) -> list[dict]:
2626
"""
2727
Create a list of image templates from a list of images.
@@ -47,7 +47,7 @@ def from_images(
4747
and not parsed_url.scheme
4848
and repo_client_slug == ClientType.GITLAB
4949
and project_id
50-
and parsed_url.path.startswith("uploads/")
50+
and parsed_url.path.startswith(("/uploads/", "uploads/"))
5151
):
5252
_repo_image_url = build_uri(f"{settings.GITLAB_URL}api/v4/projects/{project_id}/", image.url)
5353
image_url = url_to_data_url(

daiv/automation/agents/issue_addressor/agent.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,13 @@ def prepare_data(self, state: OverallState, config: RunnableConfig) -> Command[L
103103
return Command(
104104
goto="plan_and_execute",
105105
update={
106-
"image_templates": extracted_images,
107106
"messages": HumanMessagePromptTemplate.from_template(
108107
[issue_addressor_human] + extracted_images, "jinja2"
109108
).format_messages(
110109
issue_title=state["issue_title"],
111110
issue_description=state["issue_description"],
112111
project_description=repo_config.repository_description,
113-
),
112+
)
114113
},
115114
)
116115

daiv/automation/agents/issue_addressor/state.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@ class OverallState(MessagesState):
1616
"""
1717
Whether the issue is a request for changes.
1818
"""
19-
20-
image_templates: list[dict]
21-
"""
22-
The image templates to be used in the issue addressor.
23-
"""

daiv/automation/agents/plan_and_execute/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def execute_plan(
156156
store=store,
157157
prompt=ChatPromptTemplate.from_messages([
158158
execute_plan_system,
159-
HumanMessagePromptTemplate.from_template([execute_plan_human] + state["image_templates"], "jinja2"),
159+
HumanMessagePromptTemplate.from_template(execute_plan_human, "jinja2"),
160160
MessagesPlaceholder("messages"),
161161
]).partial(current_date_time=timezone.now().strftime("%d %B, %Y %H:%M")),
162162
checkpointer=False, # Disable checkpointer to avoid storing the execution in the store

daiv/automation/agents/plan_and_execute/prompts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
3333
<making_the_plan>
3434
When creating the plan, you must ensure that changes are broken down so that they can be applied in parallel and independently. Each change SHOULD be self-contained and actionable, focusing only on the changes that need to be made to address the user request. Be sure to include all details and describe code locations by pattern. Do not include preambles or post-amble changes, focus only on the user request. When providing the plan only describe the changes to be made using natural language, don't implement the changes yourself, you're the architect, not the engineer.
35+
If images are provided, describe them in detail, but only what's relevant to the user request. Use the `think` tool in a separate step to analyze the images.
3536
3637
REMEMBER: You're the architect, so be detailed and specific about the changes that need to be made to ensure that user requirements are met and codebase quality is maintained; the engineer will be doing the actual implementation and writing of the code, and their success depends on the plan you provide.
3738
</making_the_plan>

daiv/automation/agents/plan_and_execute/state.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ class PlanAndExecuteState(MessagesState):
2626
The state of the overall plan and execute agent.
2727
"""
2828

29-
image_templates: list[dict]
30-
"""
31-
The image templates to be used in the plan and execute agent.
32-
"""
33-
3429
plan_questions: list[str]
3530
"""
3631
The questions to be answered by the human to clarify it's intent.

daiv/codebase/managers/issue_addressor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _process_issue(self, should_reset_plan: bool):
117117
"source_repo_id": self.repo_id,
118118
"source_ref": self.ref,
119119
"issue_id": self.issue.iid,
120-
"repo_client": str(self.client.client_slug),
120+
"repo_client": self.client.client_slug,
121121
},
122122
)
123123

0 commit comments

Comments
 (0)