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

fix: [Ai] add comment function will delete selecetd code #1044

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

LiHua000
Copy link
Contributor

@LiHua000 LiHua000 commented Jan 6, 2025

@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • copilotapi.cpp文件中新增的sendNotify函数缺少对type参数的有效性检查,可能导致未知的通知类型被发送。
  • sendNotify函数中的name参数固定为"AI",这可能不是最佳实践,应该允许动态设置。
  • slotReadReply函数中发送通知时,msg参数使用了reply->errorString(),但没有处理可能为空的错误字符串。
  • copilot.cpp文件中replaceSelectedText函数调用前没有检查response是否为空,可能会导致空字符串替换选中文本。

是否建议立即修改:

  • 应该立即添加对type参数的检查,确保只发送有效的通知类型。
  • 考虑将name参数设置为可配置的,以便于通知的个性化。
  • 在发送通知之前,应该检查reply->errorString()是否为空,以避免发送空消息。
  • 在调用replaceSelectedText之前,应该检查response是否为空,以避免不必要的操作。

Copy link

github-actions bot commented Jan 6, 2025

  • 敏感词检查失败, 检测到1个文件存在敏感词
详情
{
    "src/plugins/codegeex/copilot.cpp": [
        {
            "line": "static const char *kUrlSSEChat = \"https://codegeex.cn/prod/code/chatCodeSseV3/chat\";",
            "line_number": 17,
            "rule": "S35",
            "reason": "Url link | 9a3dc8cf24"
        },
        {
            "line": "static const char *kUrlGenerateMultiLine = \"https://api.codegeex.cn:8443/v3/completions/inline?stream=false\";",
            "line_number": 18,
            "rule": "S35",
            "reason": "Url link | e01ed92bb3"
        }
    ]
}

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Kakueeen, LiHua000
Once this PR has been reviewed and has the lgtm label, please assign toberyan for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-mozart deepin-mozart merged commit 55fabff into linuxdeepin:master Jan 7, 2025
9 of 10 checks passed
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.

4 participants