Enterprise code generation

更新时间:
复制 MD 格式

Qoder CN provides a retrieval-augmented generation capability for inline code generation. When you use the inline code generation feature of Qoder CN, it can use your enterprise's code repository as context for inline code completion. This ensures that the completed code is more aligned with your enterprise's coding standards and business characteristics.

Important

This feature is currently available only for the Visual Studio Code and JetBrains IDE plug-ins. It is not supported in the Qoder CN IDE.

Applicable editions

Enterprise Standard Edition, Enterprise Dedicated Edition

Qoder CN administrators and organization-level global administrators (for Enterprise Dedicated Edition) can add or remove code archives and enable or disable the retrieval-augmented generation feature on the page of the Qoder CN console.

Enterprise knowledge base management

Qoder CN administrators and organization-level global administrators (for Enterprise Dedicated Edition) can manage enterprise knowledge bases. This includes creating, editing, and deleting knowledge bases, managing member visibility, and adding or removing code archives from a knowledge base.

Create, edit, and delete a knowledge base

Create a knowledge base

  1. In the sidebar, click Knowledge management.

  2. On the Knowledge management page, click New knowledge base.

  3. In the dialog box, configure the following parameters:

    • Set Application scenario to inline code generation.

    • Enter a clear and recognizable Knowledge base name.

    • (Optional) Enter a Description to summarize the content or purpose of the knowledge base.

    • Select the Visibility. The default, Private, makes the knowledge base visible only to its members.

  4. After you configure the parameters, click OK.

  5. After creation, the new knowledge base appears in the list on the Knowledge management page.

Edit a knowledge base

You can modify a knowledge base's name, description, and visibility in either of the following ways:

  1. From the Knowledge management page: In the knowledge base list, find the knowledge base that you want to modify and click the edit icon.

  2. From the knowledge base details page: Go to the details page of the knowledge base that you want to modify and click the edit icon.

Delete a knowledge base

To delete a knowledge base, go to its details page and click the delete button. You must enter the knowledge base name to confirm the deletion.

Important

A deleted knowledge base cannot be recovered. To restore it, you must create a new one and add the data again.

Upload a code archive

Qoder CN administrators and organization-level global administrators (for Enterprise Dedicated Edition) can manage the data within a knowledge base. To upload data, perform the following steps:

  1. Click Add data.

  2. With the data type set to Code, click or drag a code archive into the upload area (the gray area).

    When you upload a file, note the following requirements:

    • Upload one code repository archive at a time.

    • Supported file formats: zip, gz, and tar.gz.

    • The file size cannot exceed 100 MB.

    • The file name cannot exceed 200 characters in length, and only UTF-8 and GBK file encoding are supported.

    • To prevent missing information during information retrieval, we recommend that you use a hierarchical and structured code repository.

  3. After the upload is complete, click Confirm add. The system starts to process the code archive.

Note

For code knowledge bases, do not use your main business repositories. Instead, use common resources like second-party package source code and utility libraries to improve inline code generation quality.

Enable or disable retrieval-augmented generation

After the system finishes processing the code archive, you can enable or disable retrieval-augmented inline code generation in one of the following ways:

  1. On the Knowledge management page: In the knowledge base list, find the target knowledge base and toggle the retrieval-augmented generation switch.

  1. On the knowledge base details page: Go to the details page of the target knowledge base and toggle the retrieval-augmented generation switch.

The Enable retrieval-augmented generation switch is in the upper-right corner of the knowledge base details page.

After this feature is enabled, when authorized developers use the Qoder CN inline intelligent code generation feature in the IDE client, the feature will generate code suggestions based on the uploaded code data.

Use case

Typically, a front-end team maintains unified coding standards. For example, when developing with ReactJS, the team often defines clear good and bad practices for writing props to improve code clarity and efficiency and to avoid potential poor coding habits.

import React from 'react'
type Props = {
  children:react.reactnode;
}
// bad
const lndex = (props: Props)=> {
  return <>{props.children}</>
}
// bad
const Index<Props>=({ children }) => {
  return <>{children}</>
}
// good
const Index: React.FC<Props> = (props) => {
  return <>{props.children}</>
}

In this case, you can enhance generation by using the Qoder CN code repository. The steps are as follows:

  1. A Qoder CN administrator uploads a code archive that follows your coding standards to the console. For example, you can upload the Ant Design repository, which follows strict React component design standards.

  2. Enable retrieval-augmented inline code generation.

  3. Front-end engineers on the team install and enable Qoder CN in their IDEs.

  4. When a front-end engineer writes code, Qoder CN provides code suggestions that follow the coding standards from the uploaded repository.

import React from 'react';
interface IProps {}
const Index: React.FC<IProps> = () => {
    return <div>Index</div>;
};

Manage knowledge base visibility

Qoder CN administrators and organization-level global administrators (for Enterprise Dedicated Edition) can change the visibility of an enterprise knowledge base in one of two ways:

  1. Modify the visibility setting when you edit the knowledge base.

  2. Go to the knowledge base, click the Visible Members tab, and then add or remove members.

Note

When retrieval-augmented generation is enabled for a knowledge base, developers in your organization can use the #teamDocs feature in their IDE for inline code generation. Qoder CN generates code suggestions based on data from all knowledge bases visible to the developer.

View data processing status

After you upload a code archive, the system performs vectorization on the data. This process converts the code into a format that enables retrieval-augmented generation. You can view the data processing status in the code repository list. Possible statuses include:

  • Waiting for processing: The system processes uploaded files in order. Files that have not yet started processing are queued.

  • Processing: The file is being analyzed and vectorized.

  • Completed: The file has been analyzed and the vectorization is complete.

  • Abnormal: An error occurred during processing. You can hover over the status indicator to view the cause of the error. Based on the error, you can reprocess or delete the file.

  • Duplicate file: The file content is identical to an already processed file. The system skips duplicate files. You can delete this file.

Update a code repository

If your code repository is updated, upload the new version as a new file. The new file will be processed after it is uploaded.

Delete a code repository

To delete individual abnormal, duplicate, or unneeded code repositories, click the delete icon for each repository. To delete repositories in bulk, select the checkboxes for the repositories in the list and then click the delete button.