# coding: utf-8 import os import re from typing import Tuple, Any from aworld.core.tool.action_factory import ActionFactory from aworld.core.common import ActionModel, ActionResult from aworld.logs.util import logger from aworld.core.tool.action import ExecutableAction from aworld.models.llm import get_llm_model, call_llm_model @ActionFactory.register(name="write_html", desc="a tool use for write html.", tool_name="html") class WriteHTML(ExecutableAction): def act(self, action: ActionModel, **kwargs) -> Tuple[ActionResult, Any]: logger.info("start write html!") goal = action.params.get("goal") information = action.params.get("information") llm_conf = kwargs.get("llm_config") llm = get_llm_model(llm_conf) sys_prompt = "you are a helpful html writer." prompt = """Your task is to create a detailed and visually appealing HTML document based on the specified theme. The document must meet the following requirements, and you should utilize the provided reference materials to ensure accuracy and aesthetic quality. 1) HTML Document Requirements Design and write the HTML document according to the following specifications: Theme : {goal} Related Info: {information} Structural Requirements : Use semantic HTML tags (e.g.,
,
,