Spaces:
Runtime error
Runtime error
Pedro Bento
commited on
Commit
·
10931f7
1
Parent(s):
23b379c
Fixes
Browse files
tdagent/tools/lookup_company_cloud_account_information.py
CHANGED
@@ -75,14 +75,18 @@ def lookup_cloud_account(public_cloud_provider, account_id):
|
|
75 |
"error": "Account not found",
|
76 |
"public_cloud_provider": "{public_cloud_provider}",
|
77 |
"account_id": "{account_id}",
|
78 |
-
"message": "No cloud account found
|
79 |
}}"""
|
80 |
|
81 |
|
82 |
# Create Gradio Interface
|
83 |
gr_lookup_company_cloud_account_information = gr.Interface(
|
84 |
fn=lookup_cloud_account,
|
85 |
-
inputs=[
|
|
|
|
|
|
|
|
|
86 |
outputs="text",
|
87 |
title="Company Cloud Account Lookup System",
|
88 |
description="""
|
@@ -94,4 +98,4 @@ gr_lookup_company_cloud_account_information = gr.Interface(
|
|
94 |
GCP: project-id-123456, project-id-789012
|
95 |
""",
|
96 |
theme="default"
|
97 |
-
)
|
|
|
75 |
"error": "Account not found",
|
76 |
"public_cloud_provider": "{public_cloud_provider}",
|
77 |
"account_id": "{account_id}",
|
78 |
+
"message": "No cloud account information found"
|
79 |
}}"""
|
80 |
|
81 |
|
82 |
# Create Gradio Interface
|
83 |
gr_lookup_company_cloud_account_information = gr.Interface(
|
84 |
fn=lookup_cloud_account,
|
85 |
+
inputs=[gr.Dropdown(
|
86 |
+
choices=["AWS", "Azure", "GCP"],
|
87 |
+
label="Cloud Provider",
|
88 |
+
info="Select the cloud provider"
|
89 |
+
), "text"],
|
90 |
outputs="text",
|
91 |
title="Company Cloud Account Lookup System",
|
92 |
description="""
|
|
|
98 |
GCP: project-id-123456, project-id-789012
|
99 |
""",
|
100 |
theme="default"
|
101 |
+
)
|
tdagent/tools/send_email.py
CHANGED
@@ -3,18 +3,16 @@ import datetime
|
|
3 |
import random
|
4 |
|
5 |
|
6 |
-
def send_email(
|
7 |
"""
|
8 |
-
Simulates sending an email and prints it to the console in a well-formatted way.
|
9 |
|
10 |
This function takes email details, formats them into a standard email structure
|
11 |
with headers and body, prints the formatted email to the console, and returns
|
12 |
-
a success message.
|
13 |
|
14 |
Parameters:
|
15 |
-----------
|
16 |
-
sender : str
|
17 |
-
The email address of the sender (From field)
|
18 |
recipient : str
|
19 |
The email address of the recipient (To field)
|
20 |
subject : str
|
@@ -30,24 +28,21 @@ def send_email(sender, recipient, subject, message):
|
|
30 |
|
31 |
Example:
|
32 |
--------
|
33 |
-
>>> send_email("
|
34 |
------ EMAIL SENT ------
|
35 |
-
From:
|
36 | |
37 |
-
Subject:
|
38 |
Date: Wed, 04 Jun 2025 16:40:58 +0000
|
39 |
Message-ID: <123456.7890123456@mail-server>
|
40 |
|
41 |
-
|
42 |
------------------------
|
43 |
'Email successfully sent to [email protected] at 16:40:58'
|
44 |
-
|
45 |
-
Notes:
|
46 |
-
------
|
47 |
-
- This is a simulation function and does not actually send emails
|
48 |
-
- The Message-ID is randomly generated for each call
|
49 |
-
- The timestamp reflects the current system time
|
50 |
"""
|
|
|
|
|
|
|
51 |
# Generate a random message ID
|
52 |
message_id = f"<{random.randint(100000, 999999)}.{random.randint(1000000000, 9999999999)}@mail-server>"
|
53 |
|
@@ -71,13 +66,13 @@ Message-ID: {message_id}
|
|
71 |
print(email_format)
|
72 |
|
73 |
# Return a success message
|
74 |
-
return f"Email successfully sent to {recipient} at {datetime.datetime.now().strftime('%H:%M:%S')}"
|
75 |
|
76 |
|
77 |
# Create Gradio Interface
|
78 |
gr_send_email = gr.Interface(
|
79 |
fn=send_email,
|
80 |
-
inputs=["text", "text", "text"
|
81 |
outputs="text",
|
82 |
title="Email Sender Simulator",
|
83 |
description="This tool simulates sending an email by formatting and printing it to the console."
|
|
|
3 |
import random
|
4 |
|
5 |
|
6 |
+
def send_email(recipient, subject, message):
|
7 |
"""
|
8 |
+
Simulates sending an email from [email protected] and prints it to the console in a well-formatted way.
|
9 |
|
10 |
This function takes email details, formats them into a standard email structure
|
11 |
with headers and body, prints the formatted email to the console, and returns
|
12 |
+
a success message. The sender is always set to [email protected].
|
13 |
|
14 |
Parameters:
|
15 |
-----------
|
|
|
|
|
16 |
recipient : str
|
17 |
The email address of the recipient (To field)
|
18 |
subject : str
|
|
|
28 |
|
29 |
Example:
|
30 |
--------
|
31 |
+
>>> send_email("jane@example.com", "Security Alert", "Please update your password.")
|
32 |
------ EMAIL SENT ------
|
33 |
+
From: cert@company.com
|
34 | |
35 |
+
Subject: Security Alert
|
36 |
Date: Wed, 04 Jun 2025 16:40:58 +0000
|
37 |
Message-ID: <123456.7890123456@mail-server>
|
38 |
|
39 |
+
Please update your password.
|
40 |
------------------------
|
41 |
'Email successfully sent to [email protected] at 16:40:58'
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
"""
|
43 |
+
# Fixed sender email
|
44 |
+
sender = "[email protected]"
|
45 |
+
|
46 |
# Generate a random message ID
|
47 |
message_id = f"<{random.randint(100000, 999999)}.{random.randint(1000000000, 9999999999)}@mail-server>"
|
48 |
|
|
|
66 |
print(email_format)
|
67 |
|
68 |
# Return a success message
|
69 |
+
return f"Email successfully sent from {sender} to {recipient} at {datetime.datetime.now().strftime('%H:%M:%S')}"
|
70 |
|
71 |
|
72 |
# Create Gradio Interface
|
73 |
gr_send_email = gr.Interface(
|
74 |
fn=send_email,
|
75 |
+
inputs=["text", "text", "text"],
|
76 |
outputs="text",
|
77 |
title="Email Sender Simulator",
|
78 |
description="This tool simulates sending an email by formatting and printing it to the console."
|