Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ui/src/views/application/ApplicationSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) {
console.log(applicationForm.value)
loadSharedApi({ type: 'application', systemType: apiType.value })
.putApplication(id, applicationForm.value, loading)
.then(() => {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The code provided looks generally correct, but there are a few suggestions and improvements to make it cleaner:

  1. Function Return Type: It's good practice to define the return type of an asynchronous function. You can add async void at the end of the line where you declare const submit.

  2. Empty Object Check: In the .then() block after submitting the application, it would be more explicit to check if the response is a success.

async (formEl: FormInstance | undefined) => Promise<void> {
  1. Consistent Spacing: Ensure consistent spacing around operators and parentheses for better readability.

  2. Error Handling: Consider adding error handling in case loadSharedApi fails or throws an exception.

Here's the revised code with these suggestions applied:

@@ -773,8 +773,6 @@ const submit = async (formEl: FormInstance | undefined): Promise<void> => {
   if (!formEl) return

   await formEl.validate((valid, fields) => {
     if (valid) {
-      console.log(applicationForm.value)
       try {
         await loadSharedApi({ type: 'application', systemType: apiType.value })
           .putApplication(id, applicationForm.value, loading)
           .then(response => {
             // Assuming loadSharedApi returns a promise that resolves on success
             if (response.success) {
               console.log('Application submitted successfully');
             } else {
               console.error('Failed to submit application:', response.errorMessage);
             }
           })
           .catch(error => {
             console.error('An error occurred while submitting the application:', error.message);
           });
       } catch (error) {
         console.error('An unexpected error occurred:', error);
       }

     } else {
       console.error('Validation failed:', fields);
     }
   });
}

These changes improve the structure and clarity of the code while ensuring that it handles various scenarios gracefully, such as successful submission and errors during submission.

Expand Down
6 changes: 6 additions & 0 deletions ui/src/views/application/component/GeneratePromptDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ const promptTemplates = {

请按以下格式生成:

必须严格遵循以下规则:
1. **严格禁止输出解释、前言、额外说明**,只输出最终结果。
2. **严格使用以下格式**,不能缺少标题、不能多出其他段落。

# 角色:


Expand Down Expand Up @@ -157,6 +161,8 @@ const promptTemplates = {
- 不得提供任何与角色设定无关的回答。
2. 描述角色在互动过程中需要遵循的限制条件2
3. 描述角色在互动过程中需要遵循的限制条件3

输出时不得包含任何解释或附加说明,只能返回符合以上格式的内容。
`,
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

# 角色:
## 只需回答代码片段中的错误提示,并按照格式要求进行回复。不要包含任何额外评论或解释。

Expand Down
Loading