1 - SmartCode AI Coding Assistant

SmartCode AI Coding Assistant is an LLM driven coding assistant that can help developers improve coding efficiency, reduce repetitive work, and enhance code quality. SmartCode provides plugins on popular IDEs and supports multiple programming languages.

1.1 - SmartCode AI Coding Assistant (VSCode)

SmartCode offers a user-friendly AI Coding Assistant extension for VSCode, supporting a wide range of full-stack programming languages, including JavaScript, Node.js, Java, Kotlin, Python, Go, C#, and more. It provides features such as AI code completion, code generation, refactoring, navigation, and code analysis, helping developers enhance coding efficiency, reduce costs, and improve quality. This document guides users through the basic steps of installing the SmartCode plugin and logging into the AISE system. It also explains the plugin update mechanism and configuration settings.

Install, Config and Login

This document provides instructions for users on how to install the SmartCode plugin and log into the AISE system. Additionally, it explains the plugin update mechanism and configuration settings.

Get Installer

The SmartCode VSCode plugin, as the AI Coding Assistant plugin provided by the AISE system for Visual Studio Code, can be obtained through the AISE service. You need to first obtain the following information from the AISE administrator specified by your organization:

  • AISE Service URL
  • Your AISE Account

After obtaining the above information, please follow steps below:

  1. Open the browser and enter [AISE Service URL].

  2. Enter your [AISE account], and you can see the following page.

用户登录首页

  1. Click on the Applications | Marketplace in the left menu, and you can see the following page.

应用市场首页

  1. According to the IDE you are using, click the Download button on the corresponding application to download the latest extension installation package. The VSCode installation package is in vsix format.

Extension Install and Update

Install Extension and AISE Service URL config

  1. After the download is completed, open Visual Studio Code, click the Extensions icon on the left toolbar, select Install from VSIX in the … menu in the upper right corner, and select the vsix file downloaded in the previous step in the popped-up file selection dialog to complete the installation.

VSCode 插件安装

  1. After the installation is completed, similar screen will appear, and the words SmartCode will be displayed on the status bar, indicating that the installation is successful.

VSCode 插件安装

  1. Configure [AISE Service URL]. If your extensions is a universal vsix, you may need to configure the Service URL before using it.

Click Open Settings in the above figure, or click the SmartCode icon and select Settings in the popped-up menu.

VSCode SmartCode 配置入口

This will open the built-in settings page of VSCode and filter to the SmartCode-related configuration items at the same time. Find the AISE Service URL configuration item among them and enter your address. If your address is correct, the bottom status bar will become the status of SmartCode [Please log in].

VSCode SmartCode 配置服务地址

Login

After configuring the service URL as above, users can log in to the system with their own [AISE account].

  1. Click the SmartCode icon on the status bar and select Login in the popped-up menu.

VSCode SmartCode 登录

  1. VSCode will prompt the user to open the browser or log in manually by copying the login address. Click the “Open” button.

VSCode SmartCode 登录

  1. Use your [AISE account] to complete the login in the opened browser. If the browser shows the following information, it means that the login is successful. SmartCode should detect the login status within a few seconds and complete the login by itself. The complete login process video is as follows.

Obtain the extension information

The SmartCode plugin provides About menu, which contains the basic information of the plugin and the IDE, and this information is helpful for locating problems. Users can open it by clicking the SmartCode icon on the status bar and selecting About.

插件信息

The popped-up view contains a Copy button, which can be used to copy all the information.

插件信息

Configuration

The plugin configuration of SmartCode for VSCode is divided into two parts: general configuration and Chat configuration. The general configuration is located in the built-in configuration system of VSCode; the Chat configuration is embedded in the SmartCode Chat interface to provide users with more flexible configuration capabilities.

Manage General Configuration

To manage the general configuration, you can click the SmartCode status bar icon and select Configuration to enter the following interface.

插件信息

The currently supported configuration items and function descriptions are as follows.

Item Description
Smartcode:Language
SmartCode Language
Controls the default language used by the large model to reply in Chat, and supports:
• Chinese (default)
• English

Note: This configuration can be different from the interface language of VSCode, allowing users to interact with the Chinese large model on the English version of VSCode.
Smartcode:Version Check Mode
SmartCode Automatic update mode
Controls the automatic update behavior of SmartCode
• Always (default) - Always prompt the user when a new version appears, and the user chooses to install
• AlwaysUpdateQuite - Immediately download and update when a new version appears, and only prompt the user to restart the VSCode application to update
• Manual - Will not automatically check for new versions, and the user triggers the new version check and update action through Version Check in the menu.
Smartcode:Version Check Notification
SmartCode Automatic update notification prompt mode
Controls the notification behavior of SmartCode to the user when a new version is detected
• On (default) - Immediately notify the user when a new version is detected
• Off - Do not notify the user
• OffUntilRestart - Stop notifying until the next restart of VSCode

Note: The new version notification provides a button that allows the user to set it to Off or OffUntilRestart.
Smartcode:Aise Host
AISE Service URL
Controls the server address connected by the SmartCode plugin
Note: The enterprise version plugin generally has a built-in server address.
Smartcode:Enable
Code completion control
For the code completion feature, it allows users to control to enable or disable the code completion feature in a certain development language. It needs to be implemented by manually editing the setting.json.
Smartcode:Inline Suggest:Enable
Whether to provide in-line code completion.
Controls whether to enable the code completion function.
Smartcode:Editor: Enable Auto Completions
Automatically display in-line code completion.
Controls whether the completion content is automatically displayed in the editor.
Smartcode:Emoji Enabled
Simplified version of Emoji symbols as Git commit information.
Controls whether to use Emoji symbols when generating commit comments.
Smartcode:Full Git Moji Spec
Complete GitEmoji symbols as Git commit information.
Controls whether to use the complete GitEmoji symbols when generating commit comments.

Manage Chat Configuration

Click the settings icon in the upper right corner of the Chat window to enter the Chat configuration page.

插件信息

当前支持的配置项和功能说明如下

Item Description
LLM Model Controls the large model instance used in the current conversation.
The AISE service allows configuring multiple large model instances and allows administrators to configure the conversation model visible to the user in the department control panel. What is listed in this list is the large model instance available to the current user.
AI assistant Controls the AI assistant role set for the large model in the current conversation.
The AISE service allows administrators to set different AI assistant role behaviors for different users, that is, the system message setting (System Message) of the large model. Through the system message, the current role setting of the model can be controlled to ensure that the model behavior complies with the enterprise organization strategy.
The AISE service also allows users to set their own AI assistant role used by themselves through AISE Service
Behavior Controls the behavior pattern of the large model and provides the following options
• Precise (default) - Applicable to most software development scenarios to ensure that the content generated by the model under the same prompt remains as consistent as possible
• Balanced - Moderately relaxes the freedom of the model and is suitable for scenarios that require trying different choices, and the possibility of the model generating different generated content under the same prompt increases appropriately
• Creativity - Allows the model to play and create.
Response length (Token) Controls the maximum token length of the generated content for each large model request, and provides the following options
• 400 (default)
• 800
• 1000
• 2500
Note: Since the maximum generated token width supported by different models is different, this setting needs to be adjusted appropriately according to the current model’s ability.
History Controls whether to add historical messages for the current large model request, and provides the following options
• Automatic (default): Automatically add as many historical messages as possible according to the remaining tokens in the current user’s context
• Do not include: Disable historical messages, and each conversation is independent.

Automatic upgrade

The SmartCode for VSCode plugin, in cooperation with the AISE Base Service, supports the automatic upgrade ability. This function does not depend on the VSCode plugin market, and can realize the push and automatic update of the new version of the plugin within the enterprise, and allows users or administrators to conduct detailed control over the upgrade behavior. The version detection or upgrade process is as follows.

  1. When the user restarts VSCode, SmartCode will automatically connect to the server to check if there is an upgradable new version. Users can also manually trigger it by clicking the SmartCode icon in the status bar and choosing Version Check in the popped-up menu. Once a new version is detected, the following message will pop up to prompt the user. The user can choose Upgrade or Cancel this upgrade.

插件升级

  1. After the user clicks the Upgrade button, SmartCode will automatically download the new version installation package in the background and update the plugin in the current environment. After the upgrade is completed, there will be the following prompt.

插件升级

  1. Click Reload to complete the entire upgrade process.

1.2 - SmartCode AI编码助手 JetBrains插件

SmartCode 为使用 JetBrains 全系列IDE的开发者提供的简单易用的AI编程助手插件,支持IntelliJ IDEA, PyCharm, GoLand, Rider, PhpStorm, WebStorm和Andriod Studio全系列JetBrains IDE。提供多种开发语言,Java、Kotlin、Python、Go、C#等的支持。提供智能代码补全、智能代码生成、智能代码重构、智能代码导航、智能代码分析等功能,帮助开发者提升编码效率,降低编码成本,提高代码质量。本文档将引导用户完成SmartCode插件的安装和登录AISE系统的基本操作,同时对插件更新机制和插件配置进行说明。

安装、配置和登录系统

本文档引导用户完成 SmartCode 插件的安装和登录AISE系统的基本操作,同时对插件更新机制和插件配置进行说明。

获取插件安装包

SmartCode VSCode 插件作为 AISE系统针对 Visual Studio Code 提供的 AI编码助手 插件,可以通过 AISE服务 进行获取。您需要首先从您组织指定的 AISE管理员 处获取以下信息:

  • AISE服务地址
  • 您的AISE账号

获取以上信息后,请按以下操作步骤进行操作:

  1. 打开浏览器,并输入 【AISE服务地址】

  2. 输入您的 【AISE账号】,即可进入如下界面

用户登录首页

  1. 点击左侧菜单的 应用 | 应用市场 ,即可进入如下界面

应用市场首页

  1. 根据您所使用的IDE点击对应应用上的 安装 按钮,即可下载最新的 插件安装包。IDEA安装包为zip格式。

插件安装和更新

插件安装和服务地址配置

  1. 下载完成后,打开 JetBrains IDE,通过菜单进入设置 | 插件 视图,并点击 齿轮 图标,在弹出的对话框中选择 从磁盘安装插件 …。在弹出的文件选择对话框中选择上一步下载的 zip文件。

插件安装

  1. 安装完成后SmartCode插件会出现在 已安装 的插件列表中,请点击 重启IDE 完成激活过程。

插件安装完成

  1. 配置 【AISE服务地址】,如果您的插件是通用插件,可能会出现以下提示信息,表示需要先配置服务地址才能使用。

插件安装完成

点击上图中的 修改设置,或者点击 SmartCode 图标,在弹出的菜单中选择 修改设置

插件安装完成

这个操作会开启 JetBrains IDE 内置的设置界面,同时过滤到 SmartCode 相关的配置项上,在其中找到 AISE服务地址 配置项,输入您的 【AISE服务地址】。如果您的地址正确,底部状态栏会显示 登录以使用AISE 的状态。

插件安装完成

登录

以上配置好服务地址后,用户即可使用自己的 【AISE账号】登录系统。

  1. 点击状态栏上 SmartCode 图标,在弹出的菜单中选择 登录到AISE

插件登录

  1. JetBrains 会自动打开浏览器进入 AISE登录界面,如果您之前已经登录AISE服务器,那么会自动完成登录动作。

插件登录

  1. 在开启的浏览器中使用您的【AISE账号】完成登录,浏览器显示如下信息,即代表登录成功。

插件登录

插件端应该在几秒钟内检测到登录状态,自行完成登录。完整登录过程视频如下

获取插件信息

SmartCode 插件提供一个 关于 界面,包含了插件和IDE的基本信息,这些信息有助于在遇到问题时的定位。用户可以通过点击状态栏 SmartCode图标 并选择 关于 开启。

插件信息

弹出的视图中包含一个 复制 按钮,可以用来复制所有信息。

插件信息

插件配置

SmartCode for JetBrains 的插件配置分为 通用配置Chat配置 两部分,通用配置通过 JetBrains IDE 内置的配置系统实现,属于静态配置;Chat配置则嵌入在 SmartCode Chat 界面中,为用户提供更灵活的动态配置能力。

管理通用配置

管理通用配置可以通过点击 SmartCode 状态栏图标,并选择 修改配置 进入以下界面

插件信息

当前支持的配置项和功能说明如下

配置项 说 明
显示语言 控制在插件相关界面中所使用的自然语言,包括插件本身控制界面和Chat中文模型回复的默认语言
• 中文(默认)
• 英文
说明:此配置可以与JetBrains的界面语言不同,支持用户实现中文版本JetBrains上使用中文与大模型进行交互
版本检查模式 控制SmartCode的自动检查版本更新的行为
• 自动检查(每小时)(默认)- 在新版本出现时总是提示用户,并由用户选择合适安装。每次自动检查间隔一小时。
• 手工检查 - 不会自动检查新版本,由用户通过菜单中的检查更新触发新版本检查和更新动作
AISE服务地址 控制SmartCode插件所连接的服务器地址
说明:企业版插件一般都会内置服务器地址。
最大补全Token数 控制代码补全特性每次从模型请求的补全长度
• 默认值:300
说明:不建议用户自行调整参数,过长的补全长度会降低补全的速度和精度,并会对模型服务造成较大压力。
自动补全 控制是否启用代码补全功能
• 开启(默认)
• 关闭
补全模式 控制代码补全的模式
• 单行补全(行级)(默认)
• 多行补全(方法级)
CodeLens 控制是否在函数方法体上方使用悬浮方式显示快捷菜单
日志级别 控制SmartCode输出日志的模式
• 信息(默认)
• 调试
说明:一般情况下不建议设置为调试模式,该模式应由技术支持人员指定情况下使用。

管理Chat配置

点击Chat窗口右上角的 设置图标 即可进入Chat配置页面

插件信息

当前支持的配置项和功能说明如下

配置项 说明
模型 控制当前对话所使用的大模型实例。
AISE服务允许配置多个大模型实例,并允许管理员根据用户在部门控制面板可见的对话模型。此列表中列出的是当前用户可用的大模型实例。
AI助理 控制当前对话为大模型设定的AI助理角色。
AISE服务允许管理员为不同用户设定不同的AI助理角色行为,即大模型的系统消息设置(System Message),通过系统消息可以控制模型当前的角色设定,确保模型行为符合企业组织策略。
AISE服务也允许用户通过AISE服务
行为 控制大模型行为模式,提供以下选项
• 精确(默认)- 适用于大多数软件开发场景,确保模型在同样提示下所生成的内容尽量保持一致
• 平衡 - 适当放宽模型的自由度,适合于需要尝试不同选择的场景,模型在同样提示下产生不同生成内容的可能性适当增加
• 创造力 - 允许模型进行发挥和创造
回复长度 控制每次大模型请求生成内容的最大token长度,提供以下选项
• 400(默认)
• 800
• 1000
• 2500
说明:由于不同模型所支持的最大生成token宽度不同,此设定需要根据当前模型的能力适当调整
历史 控制是否为当前大模型请求添加历史消息,提供以下选择
• 自动(默认):根据当前用户上下文token余量,自动添加尽量多的历史消息
• 不包含:禁用历史消息,每次对话均独立

自动升级

SmartCode for JetBrains 插件配合 AISE服务 支持自动升级能力,AISE服务 内置兼容JetBrains插件市场的API,可以在企业内部实现新版插件的推送和自动更新,并允许用户或者管理员对于升级行为进行细化控制。

版本检测或者升级过程如下

  1. 当用户重新启动JetBrains IDE 时,SmartCode会自动连接服务器检查是否存在可升级的新版本。用户也可以通过点击 状态栏的SmartCode图标,在弹出的菜单中选择 检查更新 的方式手工触发。 一旦检测到新版本,会弹出以下消息提示用户。用户可以选择 升级 或者 取消 本次升级。

插件信息

  1. 用户点击 升级 按钮后,SmartCode会开启JetBrains IDE内置的插件更新界面。插件会显示为可更新状态,点击 更新 即可启动升级动作。

插件信息

  1. 升级完成后需要点击 重启IDE 即可完成整个升级过程。

JCEF安装步骤

Andriod Studio 是 Google 基于 JetBrains的IDE框架另外开发的用户andriod开发的IDE环境,默认不带JCEF框架。JCEF框架是用来在IDE中嵌入web应用的框架。SmartCode插件的chat组件使用了一个本地运行的web app应用,需要使用JCEF框架才能在Android Studio中正常显示和使用。其他JetBrains家族产品,比如IDEA,pycharm等会自带JCEF框架,无需按照本文档进行处理。 注意:Android Studio 版本低于2023.3.1的不支持选择本地路径。只能联网自动下载,需要配置Android Studio的代理,设置代理的主要目的是让 Android Studio 可以连接到github获取JCEF sdk包的列表数据,如果连接不到github,用户将看不到这个列表。

安装JCEF的步骤分为2步,以下2个步骤完成后,需要重新启动IDE再安装SmartCode插件。如果在使用本文档之前已经安装了SmartCode需要先卸载掉。

  1. 安装JCEF
  2. 修改Andriod Studio注册表

下载对应版本

https://github.com/JetBrains/JetBrainsRuntime/releases/tag/jbr-release-17.0.10b1087.21

Android Studio设置自定义JBR

  • 打开菜单项帮助查找操作…并搜索 “Choose Boot Java runtime for the IDE…”

JCEF安装

  • 选择解压的JBR目录,IDE 将重新启动。

JCEF安装

低于2023.3.1安装

设置代理的主要目的是让 Android Studio 可以连接到github获取JCEF sdk包的列表数据,如果连接不到github,用户将看不到这个列表。 因此,用户可以自行解决代理的问题,只要确保Andriod Studio可以连接到github就可以。

  • 设置代理

JCEF安装

  • 打开菜单项帮助查找操作…并搜索 “Choose Boot Java runtime for the IDE…”
  • 在下拉列表中选择一个带JCEF的版本安装
  • 打开菜单项帮助查找操作…并搜索 “Registry…”,修改注册表
  • 重启后安装插件

JCEF安装

修改Andriod Studio注册表

  • 打开菜单项帮助查找操作…并搜索 “Registry…”

JCEF安装

JCEF安装

ide.browser.jcef.contextMenu.devTools.enabled true
ide.browser.jcef.sandbox.enable false
ide.browser.jcef.gpu.disable true

重启Android Studio后安装插件

以上操作完成后,重新启动Andriod Studio再安装SmartCode插件。

2 - Code Review Agent 代码评审智能体

Code Review Agent 代码评审智能体 是一个基于AI的代码评审工具,使用此工具可以自动生成 Pull Request(PR) 描述,提供代码改进建议,生成Change Logs。支持接入主流Azure DevOps Repos 等主流 Git工具。Code Review Agent会自动对向代码库提交的PR进行检索并自动生成PR描述和代码优化建议等。Code Review Agent为项目经理, 架构师,开发/测试人员提供了对代码库PR的代码检测能力,可以帮助我们快速了解PR到代码库代码的质量,并提供优化建议。

使用流程

创建 PR

Code Review Agent 代码评审智能体 会自动生成PR的标题、类型、摘要和代码变更说明,这些信息将显示在PR的描述中,可以帮助评审者快速了解PR的内容。

  1. 创建Pull Request (PR) 在Azure DevOps上 上创建一个新的Pull Request。

  2. 等待片刻会自动生成PR描述

使用 /review 指令 生成PR评审

  1. 触发代码审查:在PR的评论区输入指令 /review

  2. 等待片刻会自动生成评审内容

使用 /ask 指令对当前PR提问

  1. 提出问题:在PR的评论区输入指令 /ask 问题,后跟具体问题。

  2. 等待片刻会自动生成回复内容

使用 /update_changelog 指令生成变更日志

  1. 生成PR变更日志:在PR的评论区输入指令 /update_changelog

  2. 等待片刻会自动生成变更日志

指令列表

以下指令触发式都是在PR添加评论的试,指令后可以加上具体的参数。

  • /summary 或者 /describe : 生成PR描述,创建PR是会自动生成,也可以手工执行
  • /review:触发代码审查并提供反馈。
  • /ask [问题]:提出具体问题并获取回答。
  • /update_changelog:自动生成并更新变更日志。
  • /improve --pr_code_suggestions.commitable_code_suggestions=true: 生成具体的改进代码,
  • /generate_labels:自动生成标签,并添加到当前PR中
  • /config: 获取工具配置,仅用于Code Review Agent 代码评审智能体的维护
  • /help:获取命令的使用帮助

配置指南

请参考以下链接获取详细的配置指南:配置指南

3 - SmartChat 企业级ChatGPT服务

SmartChat 为企业用户提供了一个基于浏览器的ChatGPT聊天工具,用户可以通过这个工具与各种AI模型进行智能对话,并且支持自定义AI助理、自定义提示词、多模态图片识别、文档对话和知识库对话等特性。

4 - SmartAnswer 企业知识库

SmartAnswer 企业知识库为企业用户提供了智能知识库服务,支持自动索引文件、信息管理系统,比如:Jira, Confluence, GitHub Issue 等内容,自动构建向量化知识库,提供智能搜索、智能问答等功能,帮助企业用户快速构建知识库,提升知识管理效率。