Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance the AI flag by allowing ai-assistant-server to be missing #2818

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

xudongwu-0
Copy link
Collaborator

@xudongwu-0 xudongwu-0 commented Sep 4, 2024

This PR enhances the AI flag by allowing ai-assistant-server to be missing.
The previous PR:#2808

Optional AI Assistant Configuration:

The new version allows the ai-assistant-server configuration to be missing. In this case, its behavior corresponds to the case of "NoAiAssistant".

@xudongwu-0 xudongwu-0 self-assigned this Sep 4, 2024
@chenlica chenlica changed the title Enhance the Ai flag by allowing ai-assistant-server to Be not Exist Enhance the AI flag by allowing ai-assistant-server to be missing Sep 4, 2024
Copy link
Collaborator

@chenlica chenlica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I revised the subject and description. The rest looks good.

Copy link
Collaborator

@IamtherealBrian IamtherealBrian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test run successfully on my end. LGTM.

Copy link
Collaborator

@bobbai00 bobbai00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments

Copy link
Collaborator

@bobbai00 bobbai00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xudongwu-0 xudongwu-0 merged commit 44a7ed3 into master Sep 5, 2024
8 checks passed
@xudongwu-0 xudongwu-0 deleted the ai-flag-new branch September 5, 2024 01:17
xudongwu-0 added a commit that referenced this pull request Sep 18, 2024
This PR enhances the report generation functionality by adding animation
during the process. This PR is a continuation and enhancement of the
previous PR:

Adding a button to generate a report for a workflow:
#2770
Enhancing Report Generation by adding Operator Results:
#2792
Enhancing Report Generation by Adding Operator Json and Comments Section
: #2807
Ai Flag: #2818 and
#2808

Key Changes:

**menu.component.ts:** 
At the start, notification.blank is called to display a message, and
notification.remove is used to remove it at the end. Upon successful
generation, this.notificationService.success is invoked.

**notification.service.ts:** 
notification.blank and notification.remove have been added.

Screenshot of the notification:

![image](https://github.com/user-attachments/assets/76f01cfd-dd52-4ba5-8f87-d2703473e82e)

![image](https://github.com/user-attachments/assets/a0a06876-275d-4062-a62a-0b423488107c)
xudongwu-0 added a commit that referenced this pull request Oct 15, 2024
#2816)

This PR enhances the report generation functionality by
addingStory-teller Ai based on Ai flag. This PR is a continuation and
enhancement of the previous PR:
Adding a button to generate a report for a workflow: #2770 
Enhancing Report Generation by adding Operator Results: #2792 
Enhancing Report Generation by Adding Operator Json and Comments Section
: #2807
Ai Flag: #2818 and
#2808

**New Methods:**
checkAiAssistantEnabled():
Validates whether the AI Assistant feature is enabled by checking the
availability of the required API key. This function ensures that
subsequent AI-based functionalities are executed only when the AI
Assistant is available.

generateComment(operatorInfo: any):
Generates insightful comments for each operator using OpenAI’s GPT
model, tailored for a highly educated audience but one that might not
have deep statistical knowledge. The comments are plain text, enhancing
the overall readability and value of the report.

generateSummaryComment(operatorInfo: any):
Produces a concise, insightful summary comment that highlights key
findings, trends, and areas of improvement across the workflow, focusing
particularly on UDFs. This function is crucial for providing a
comprehensive understanding of the workflow to users.

**Enhanced Methods:**
retrieveOperatorInfoReport(operatorId: string, allResults: { operatorId:
string; html: string }[]):
Implements the checkAiAssistantEnabled, generateComment, and
generateSummaryComment functions to enrich the operator information
section in the generated reports. The function now adds a "Toggle
Detail" button beneath each operator, allowing users to expand and view
the operator’s corresponding JSON, formatted using a JSON viewer.
Additionally, a comments section is added below each operator, enabling
users to leave or view AI-generated comments.

generateReportAsHtml(workflowSnapshot: string, allResults: string[],
workflowName: string):
Generates a comprehensive HTML file containing the workflow snapshot,
all operator results, operator details, and comments. This method
integrates AI-generated comments and a summary section at the end of the
report. It also introduces a "Download Workflow JSON" button, allowing
users to download the entire workflow JSON file directly from the
report.

**Operation Process:** 
Click the button below to generate the report with detailed operator
results and the workflow snapshot.

![image](https://github.com/user-attachments/assets/4c2fccf7-c931-4e9c-a2d2-a6bcc9d640a1)

To turn on the ai feature, you need to modify the following sections in
application.udf

![image](https://github.com/user-attachments/assets/d88755af-c86e-4eb3-a717-59a69b74200e)

For example, to turn on the openai:

![image](https://github.com/user-attachments/assets/588de609-806e-46f8-abea-6a08030243fb)


Here is a part of the example report.

![image](https://github.com/user-attachments/assets/3911a558-497f-45bc-a948-1a7a3a671a85)

![image](https://github.com/user-attachments/assets/f8fa5284-5a5b-4d70-a18b-283a2b3c612f)
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
)

This PR enhances the AI flag by allowing ai-assistant-server to be
missing.
The previous PR:#2808

**Optional AI Assistant Configuration:**

The new version allows the ai-assistant-server configuration to be
missing. In this case, its behavior corresponds to the case of
"NoAiAssistant".
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
This PR enhances the report generation functionality by adding animation
during the process. This PR is a continuation and enhancement of the
previous PR:

Adding a button to generate a report for a workflow:
#2770
Enhancing Report Generation by adding Operator Results:
#2792
Enhancing Report Generation by Adding Operator Json and Comments Section
: #2807
Ai Flag: #2818 and
#2808

Key Changes:

**menu.component.ts:** 
At the start, notification.blank is called to display a message, and
notification.remove is used to remove it at the end. Upon successful
generation, this.notificationService.success is invoked.

**notification.service.ts:** 
notification.blank and notification.remove have been added.

Screenshot of the notification:

![image](https://github.com/user-attachments/assets/76f01cfd-dd52-4ba5-8f87-d2703473e82e)

![image](https://github.com/user-attachments/assets/a0a06876-275d-4062-a62a-0b423488107c)
PurelyBlank pushed a commit that referenced this pull request Dec 4, 2024
#2816)

This PR enhances the report generation functionality by
addingStory-teller Ai based on Ai flag. This PR is a continuation and
enhancement of the previous PR:
Adding a button to generate a report for a workflow: #2770 
Enhancing Report Generation by adding Operator Results: #2792 
Enhancing Report Generation by Adding Operator Json and Comments Section
: #2807
Ai Flag: #2818 and
#2808

**New Methods:**
checkAiAssistantEnabled():
Validates whether the AI Assistant feature is enabled by checking the
availability of the required API key. This function ensures that
subsequent AI-based functionalities are executed only when the AI
Assistant is available.

generateComment(operatorInfo: any):
Generates insightful comments for each operator using OpenAI’s GPT
model, tailored for a highly educated audience but one that might not
have deep statistical knowledge. The comments are plain text, enhancing
the overall readability and value of the report.

generateSummaryComment(operatorInfo: any):
Produces a concise, insightful summary comment that highlights key
findings, trends, and areas of improvement across the workflow, focusing
particularly on UDFs. This function is crucial for providing a
comprehensive understanding of the workflow to users.

**Enhanced Methods:**
retrieveOperatorInfoReport(operatorId: string, allResults: { operatorId:
string; html: string }[]):
Implements the checkAiAssistantEnabled, generateComment, and
generateSummaryComment functions to enrich the operator information
section in the generated reports. The function now adds a "Toggle
Detail" button beneath each operator, allowing users to expand and view
the operator’s corresponding JSON, formatted using a JSON viewer.
Additionally, a comments section is added below each operator, enabling
users to leave or view AI-generated comments.

generateReportAsHtml(workflowSnapshot: string, allResults: string[],
workflowName: string):
Generates a comprehensive HTML file containing the workflow snapshot,
all operator results, operator details, and comments. This method
integrates AI-generated comments and a summary section at the end of the
report. It also introduces a "Download Workflow JSON" button, allowing
users to download the entire workflow JSON file directly from the
report.

**Operation Process:** 
Click the button below to generate the report with detailed operator
results and the workflow snapshot.

![image](https://github.com/user-attachments/assets/4c2fccf7-c931-4e9c-a2d2-a6bcc9d640a1)

To turn on the ai feature, you need to modify the following sections in
application.udf

![image](https://github.com/user-attachments/assets/d88755af-c86e-4eb3-a717-59a69b74200e)

For example, to turn on the openai:

![image](https://github.com/user-attachments/assets/588de609-806e-46f8-abea-6a08030243fb)


Here is a part of the example report.

![image](https://github.com/user-attachments/assets/3911a558-497f-45bc-a948-1a7a3a671a85)

![image](https://github.com/user-attachments/assets/f8fa5284-5a5b-4d70-a18b-283a2b3c612f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants