feat: Support intent detection (#1588)

This commit is contained in:
Fangyin Cheng
2024-05-30 18:51:57 +08:00
committed by GitHub
parent 73d175a127
commit a88af6f87d
22 changed files with 881 additions and 54 deletions

View File

@@ -97,9 +97,7 @@ def _create_flow_template(
if definition_type == "json":
_write_flow_define_json_file(working_directory, name, mod_name)
else:
raise click.ClickException(
f"Unsupported definition type: {definition_type} for dbgpts type: {dbgpts_type}"
)
_write_flow_define_python_file(working_directory, name, mod_name)
def _create_operator_template(
@@ -222,6 +220,16 @@ def _write_flow_define_json_file(working_directory: str, name: str, mod_name: st
print("Please write your flow json to the file: ", def_file)
def _write_flow_define_python_file(working_directory: str, name: str, mod_name: str):
"""Write the flow define python file"""
init_file = Path(working_directory) / name / mod_name / "__init__.py"
content = ""
with open(init_file, "w") as f:
f.write(f'"""{name} flow package"""\n{content}')
def _write_operator_init_file(working_directory: str, name: str, mod_name: str):
"""Write the operator __init__.py file"""