Lingma file editing provides multi-file editing and tool-use capabilities to help developers complete coding tasks, such as implementing requirements, solving problems, generating unit test cases, and performing batch code modifications. This topic describes typical backend development scenarios and provides use cases for core tasks, such as code generation, code refactoring, and automated test creation. By integrating with your private enterprise data, Lingma can provide personalized recommendations and code generation that meet your company's specific needs. This significantly improves development efficiency and quality.
Background information
In modern enterprise development, developers frequently face core tasks. These tasks include generating code based on in-house frameworks, replacing and refactoring code for different technical frameworks, and writing unit tests. However, traditional AI tools often rely on general-purpose models for code generation and recommendations. These tools struggle to integrate with private enterprise data for personalized support, which limits their effectiveness in real-world development.
Lingma provides two core features: file editing and enterprise knowledge bases. You can use file editing to generate project-level code and obtain personalized recommendations based on your private enterprise data. This provides developers with intelligent solutions that better fit their actual needs. This topic uses several use cases to demonstrate the practical application and value of Lingma in these scenarios.
To obtain the best results from knowledge base retrieval augmentation, make sure your knowledge base documents, such as API reference and technical framework descriptions, follow the specifications in Prepare the enterprise knowledge base. For more information, see Knowledge Base Construction Guide and Retrieval Augmentation Guide.
Scenario 1: Code generation based on API reference
In enterprise development, Lingma can use your API reference to quickly generate high-quality business code. You can simply enter the requirement description and relevant parameters, and Lingma automatically generates the backend code. This improves development efficiency and allows your team to focus on more valuable development work.
1. Prepare the enterprise knowledge base
API reference preparation principles
Clear structure: Organize the document logically into sections, such as interface description, request parameters, and response data. Each section must have a clear title.
Interface information:
Function: Briefly describe the function of the interface, such as retrieving a list of knowledge bases.
Method: Specify the HTTP method used, such as GET.
Address: Provide a complete sample URL.
Authentication: Describe the required authentication method, such as identity verification using the Authorization field in the request header.
Request parameters: List each parameter and specify its meaning, type, whether it is required, and its default value.
Response data: Describe the data structure for successful and error responses.
Error handling: Explain error scenarios and their corresponding status codes.
Code examples: Provide a code implementation in any language or a
curlexample. For a specific example, see the "Get Knowledge Base File List API Reference" sample that follows.
Sample document
2. Demo: Querying the Lingma knowledge base list
Scenario 2: Code generation based on a business framework
When implementing AI-powered coding in an enterprise, a common problem is that the model-generated code does not use the company's in-house technical and business frameworks. Lingma adapts to in-house frameworks by integrating with your enterprise knowledge base. For example, in a product inventory system scenario, a company can add its distributed lock implementation solution and standardized business framework documents to the enterprise knowledge base. Developers can then generate code based on a standardized inventory management module. Reusing standardized code improves development efficiency, reduces redundant development costs, ensures business logic consistency, and improves code quality.
1. Prepare the enterprise knowledge base
Knowledge selection principles
Define the target business model and specific implementation mechanisms:
Identify key business modules: Determine the key business logic modules in the system that require a unified implementation, such as inventory management, order processing, and payment systems.
Refine specific business implementation mechanisms: For example, inventory management might involve different scenarios, such as stock deduction, queries, and locking. Each scenario may require a different implementation mechanism.
Select relevant code files from the business framework and add them to the enterprise code knowledge base:
Filter the core code that implements key business logic from the business framework. Organize and store this code in a separate knowledge base. For example, stock deduction requires a distributed lock mechanism to ensure concurrency safety. Therefore, you must select the core code module that implements the distributed lock.
Business framework documentation principles
Structured presentation: The document must include an introduction, features, architecture design, usage instructions, and code examples. Use
## Module Nameand### Level Markerfor unambiguous titles.Standardized terminology: Use unified and commonly used enterprise terms, such as Lua script, synchronous message, and asynchronous message. This helps you accurately retrieve information when you write prompts in the IDE.
Code example requirements
Dependency declaration: Show the complete pom.xml or Gradle import method.
Core implementation: Provide the complete code block for Redis locking. For a specific example, see the "Redis Lock Protection" sample that follows. Make sure the document is in the enterprise knowledge base.
Sample document
2. Demo: Protecting resources with a distributed lock for e-commerce inventory management
Scenario 3: Code refactoring based on an in-house technical framework
When an enterprise adjusts its technical architecture, replacing technical components, such as replacing RabbitMQ with RocketMQ, often presents challenges. These challenges include complex code changes and difficulties in ensuring quality. Lingma uses file editing and the enterprise knowledge base to help companies efficiently replace components. This process ensures system quality and consistency while it shortens the development cycle and reduces risks.
1. Prepare the enterprise knowledge base document
Technical framework documentation principles
Structural requirements
Title levels: Use
# Main Titleto define functional modules, such as the message sending mechanism. Use##/### Subtitleto break down operational steps, such as topic creation or synchronous sending.Content isolation: Mandate separate sections for independent functional units. Describe each message sending method (synchronous, asynchronous, one-way) separately.
Description of key technical parameters
Annotate important configurations, such as
autoCreateTopicEnable, with their scope and risk scenarios.Provide specific command-line interface (CLI) command examples, such as
mqadmin updateTopic -t ORDER_TOPIC, and their output.
Code block formatting: Use Markdown's code block syntax (```) to format command lines and code. Differentiate between languages, such as Shell and Java.
Fault-tolerant design: Synchronous and asynchronous operations must include mandatory exception catching and retry mechanisms. One-way transmission is unreliable. If data loss is unacceptable, choose another method.
Code demonstration standards [Important]
End-to-end examples: For each message mode (synchronous, asynchronous, one-way), provide complete code for
initialization→sending→shutdown.Key comments: Annotate key technical points at nodes such as
producer creationandmessage body construction.
For a code example, see the "Sending Messages with the In-house Middleware RocketMQ" sample that follows. Make sure the document is in the enterprise knowledge base.
Sample document
2. Demo: Replacing the message queue component from RabbitMQ to RocketMQ
Scenario 4: Unit test agent
The unit test agent is a specialized feature of file editing. It generates unit test files in batches for code changes (#codeChanges) or for one or more code files. You can simply enter the content to be tested and the requirements. The AI automatically generates a test plan and test cases. It then compiles, runs, and automatically fixes them. This process improves test coverage and quality, and reduces your test-writing costs.
Lingma has launched the unit test agent feature, which includes automatic compilation, running, and fixing capabilities.
1. Unit test agent metrics
Technical assessment dimensions, such as compilation pass rate and run pass rate, are based on the assessment results of a local Java code assessment set:
One-time compilation pass rate: This metric measures the success rate of the code generated by the unit test agent during the compilation phase. The current compilation pass rate is 81.00%.
One-time run pass rate: The run pass rate focuses on the performance of the generated unit tests in the actual running environment. The current run pass rate is 80.55%, which shows that the performance during the execution phase is similar to that of the compilation phase.
Business effectiveness assessment - business team unit test coverage: Unit test coverage is a key metric for business teams because it reflects the extent to which automated unit tests cover the codebase. Increasing this rate not only enhances product quality but also promotes faster development cycles and higher customer satisfaction.