From 877136ebe1f397dcc2e041b4b74232f3f3e4968d Mon Sep 17 00:00:00 2001 From: xuanhun <717532978@qq.com> Date: Mon, 28 Apr 2025 11:00:14 +0800 Subject: [PATCH] docs: add trae guid --- .../Basic/DeepSeek_with_Cursor.md | 57 ++--- ...ed_with_VisActor_Using_Trae_Context_Doc.md | 197 ++++++++++++++++++ docs/assets/guide/menu.json | 7 + .../Basic/DeepSeek_With_Cursor.md | 2 +- ...ed_with_VisActor_Using_Trae_Context_Doc.md | 194 +++++++++++++++++ 5 files changed, 429 insertions(+), 28 deletions(-) create mode 100644 docs/assets/guide/en/tutorial_docs/Basic/Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc.md create mode 100644 docs/assets/guide/zh/tutorial_docs/Basic/Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc.md diff --git a/docs/assets/guide/en/tutorial_docs/Basic/DeepSeek_with_Cursor.md b/docs/assets/guide/en/tutorial_docs/Basic/DeepSeek_with_Cursor.md index 902fd3cc9c..06aad4b205 100644 --- a/docs/assets/guide/en/tutorial_docs/Basic/DeepSeek_with_Cursor.md +++ b/docs/assets/guide/en/tutorial_docs/Basic/DeepSeek_with_Cursor.md @@ -1,76 +1,79 @@ -# Cursor+DeepSeek: Quick Start to Your VChart Code +# Cursor+DeepSeek: Quick Start with Your VChart Code -In the previous sections, we have gained a basic understanding of the components of a spec and how a basic chart is generated. However, due to VChart's powerful features and diverse APIs, quickly implementing a complex chart with VChart can be challenging. Is there an easy way to get started without endlessly searching through API documentation? +In the previous chapters, we have learned about the basic components of a spec and how to generate basic charts. However, due to VChart's powerful features and diverse APIs, it can be challenging to quickly implement complex charts. Is there an easy way to get started without having to search through API documentation? -The answer is yes! Thanks to the rapid development of current AI technologies, you can quickly understand and master VChart usage with AI tools. This not only significantly boosts your coding efficiency but also allows you as a developer to focus on creativity and business logic. In this tutorial, we will configure `Cursor` and `DeepSeek` (or any other AI) to help you quickly get started with your VChart code! +The answer is yes! Thanks to the rapid development of AI technology, AI tools can not only help you quickly understand and master VChart usage but also significantly improve coding efficiency, allowing developers to focus on creativity and business logic implementation. + +In this tutorial, we'll learn how to quickly get started with your VChart code by configuring `Cursor` and `DeepSeek` (you can use other AIs as well, and Cursor's default model is also fine - the key is custom document integration)! ## 1. Preparation -### A VChart Project +### A Project Using VChart -For example, you may have a simple project initialized with: +For example, I have a simple project initialized with `npx create-react-app my-app --template typescript`, which looks like this after startup:
- 初始化项目 + Initialized Project
### DeepSeek -Register deepSeek, create a new API key on the [deepSeek api 官网](https://platform.deepseek.com/api_keys) +Register for DeepSeek and create your API key on the [DeepSeek API official website](https://platform.deepseek.com/api_keys) ### Cursor -Download and register on the [official website](https://www.cursor.com/), use `cursor` to open your VChart project, and configure `cursor` +Download and register from the [official website](https://www.cursor.com/), open your VChart project with `cursor`, and configure `cursor` + +### Configure Cursor -### Configure cursor +Take `deepSeek-V3` as an example, its model name is `deepseek-chat`, and the API address is https://api.deepseek.com/v1. For details, see the [API usage official website](https://api-docs.deepseek.com/zh-cn/) -For example, the model name is `deepseek-chat`, the API address is https://api.deepseek.com/v1, see [api usage official website](https://api-docs.deepseek.com/zh-cn/) -We create a new model in the `model` page, set the corresponding `api` address and `model` name. +Create a new model on the `model` page and set the corresponding `api` address and `model` name. -_Note: Currently, `cursor` official website does not support direct access to `deepSeek`. We can achieve access to `deepSeek` by overriding the interface address of `openAPI`. During the setup process, we need to close other models and only access `deepSeek` model_ +_Note: Currently, `cursor` officially does not support direct integration with `deepSeek`. We can achieve integration with `deepSeek` by overriding the `openAPI` interface address. During the setup process, you need to close other models first and only integrate the `deepSeek` model_
- cursor配置 + Cursor Configuration
-## 2. Practice +## 2. Practical Usage -### Add Column Chart +### Add a Bar Chart -Use `cmd+i` command to call up AI interaction, directly let AI generate a simple column chart code, apply this spec, we check the result, a simple column chart is rendered; we can find that `deepSeek` has a certain understanding of `vchart`, simple charts can be directly added, we try a more complex scenario. +Use the `cmd+i` command to invoke AI interaction, and let the AI help us generate a simple bar chart code. After applying this spec, we can see the result - a simple bar chart is rendered. We can see that `deepSeek` has a certain understanding of `vchart`, and simple charts can be added directly. Let's try a more complex scenario.

- cursor结果 - 渲染结果 + Cursor Result + Rendering Result

-### Complex Scenario, Inject Docs +### Complex Scenario: Injecting Docs -We hope to add an average auxiliary line to the y-axis, check the result, but the result is not correct, carefully check to find that `markLine` seems to be written correctly, but the `spec` does not conform to the specification, and the average line has been calculated, we solve this problem by injecting docs. +We want to add a mean auxiliary line on the y-axis. Looking at the result, it's not correct. Upon closer inspection, we can see that although `markLine` is written as expected, the `spec` doesn't conform to the specification, and the mean line has been calculated. We'll solve this problem by injecting docs.

markline_cursor markline_result

-### Set Docs +### Setting up Docs -Enter the `cursor` setting page, select `Features`, add docs, you can choose one of the following docs addresses: +Go to the `cursor` settings page, select `Features`, and add docs. You can choose from the following docs addresses: - https://visactor.com/vchart - https://visactor.io/vchart -![配置docs](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/deep_seek_6.gif) +![Configure docs](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/deep_seek_6.gif) -You can also directly add a new doc through `@Docs` in the editing page +You can also add new docs directly in the editor through `@Docs` -### Experimental Result +### Experimental Results -After editing the new added docs again, you can get the correct result! +By adding the new docs and editing again, we can get the correct result!

markline_cursor markline_result

-Through this tutorial, you have learned how to use `cursor+deepseek` to improve your VChart coding efficiency and explore the powerful features and flexibility of VChart. I wish you a pleasant coding experience! +Through this tutorial, you've learned how to improve your VChart coding efficiency using `cursor+deepseek`, while exploring VChart's powerful features and flexibility to create colorful charts. Happy coding! diff --git a/docs/assets/guide/en/tutorial_docs/Basic/Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc.md b/docs/assets/guide/en/tutorial_docs/Basic/Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc.md new file mode 100644 index 0000000000..508070033a --- /dev/null +++ b/docs/assets/guide/en/tutorial_docs/Basic/Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc.md @@ -0,0 +1,197 @@ +--- +title: Using Cursor with DeepSeek to Quickly Get Started with Unfamiliar Components + +key words: VisActor, VChart, VTable, VStory, VMind, VGrammar, VRender, Visualization, Chart, Data, Table, Graph, Gis, LLM +--- +In today's software development field, developers face the challenge of continuously improving development efficiency and reducing the learning curve. The core purpose of this document is to help developers achieve this goal, especially by cleverly using **component official documentation** and combining tools like **Cursor** and **DeepSeek** to let AI automatically generate the required code, quickly lowering the entry barrier. Next, we will experiment with several projects in the relatively new open-source project, VisActor (https://www.visactor.com; https://www.visactor.io/), an open-source visualization solution, to see how effective it is. + +# Preparation + +## Create a Test Project + +For example, I have a simple project initialized with `npx create-react-app my-app --template typescript`, which looks like this after starting: + + + +## Obtain DeepSeek API Key + +Register with DeepSeek and create your API key on the [DeepSeek API](https://platform.deepseek.com/api_keys) official website. + + + +## Configure Cursor + +Official website: https://www.cursor.com/ + +Download and register, open your VChart project with Cursor, and configure Cursor. + +Using DeepSeek-V3 as an example, its API model name is `deepseek-chat`, and the API address is https://api.deepseek.com/v1. For more details, see the [API usage official website](https://api-docs.deepseek.com/zh-cn). + +Create a new model on the model page, set the corresponding API address and model name. + + + +Of course, you can also use any other AI model; here, we use DeepSeek. + +# Inject Official Tutorial into @Docs + +# Practical Verification + +## VTable Test + +VTable (https://www.visactor.io/vtable/; https://www.visactor.com/vtable/) is a powerful table component in the VisActor visualization library. It is designed to meet diverse data presentation needs, offering high flexibility and customizability. Whether it's simple data listing or complex data analysis display scenarios, VTable can provide excellent solutions. + +VTable has the following core features: + +- Supports various table types: basic tables, pivot tables, transposed tables, pivot charts, etc. + +- Powerful interaction features: sorting, filtering, row and column dragging, cell editing, etc. + +- Rich cell types: text, charts, progress bars, checkboxes, sparklines, etc. + +- High-performance rendering: supports smooth display of millions of data + +- Multi-platform adaptation: perfect support for mainstream frameworks like Vue, React + +### Invoke AI Interaction Panel in Cursor and Generate Code + +After setting up the project environment, use `cmd + i` to invoke the AI interaction panel. We directly let AI generate a basic table code snippet for inserting VTable. + + + +However, the initial generation result shows that AI does not recognize VTable's `ListTable`, possibly due to the inability to accurately recognize VTable's ListTable configuration. + + + +### Inject Official Tutorial into @Docs + +To solve the above problem, we inject the official tutorial into @Docs. + + + +Explicitly specify `VisActor VTable` in the `prompt` in @Docs. After this step, we are pleasantly surprised to find that AI can correctly write the implementation logic according to the `option` in VTable. + + + +### Code Application and Effect Display + +Copy the generated code into the corresponding file, run the project, and you can see the initial effect, with the table correctly generated. + + + +Then, we continue to let AI modify the table style. AI provided reasonable modification suggestions, + + + +After running the project again, we got a display effect that better meets the requirements: + + + +## VChart Test + +### Add a Bar Chart + +Invoke AI interaction with the `cmd+i` command, and let AI help us generate a simple bar chart code first. + + + +Directly apply this spec, and we check the result; a simple bar chart is rendered. It can be seen that DeepSeek has a certain understanding of VChart, and simple charts can be directly added. Let's try a more complex scenario. + + + +### Complex Scenario, Inject Docs + +We hope to add an average auxiliary line on the y-axis, check the result, but the result is incorrect. Upon closer inspection, it can be found that although the markLine is written as if it is correct, the spec does not conform to the specification, and the average line is calculated. We solve this problem by injecting docs. + + + + + +#### Set Docs + +Enter the Cursor settings page, select `Features`, add new docs, the docs address is https://visactor.com/vchart (https://visactor.io/vchart); you can also directly add through @Docs on the editing page. + + + +### Experimental Results + +By editing again with the newly added docs, the correct result can be obtained! + + + + + +## VStory Test + +VStory (GitHub: https://github.com/VisActor/VStory/; site: https://www.visactor.io/vstory/, https://www.visactor.com/vstory/) is a narrative-oriented visualization development framework that integrates the capabilities of all VisActor visualization components, making it more challenging to use. We conduct a simple test. + +Invoke AI interaction with the `cmd+i` command, and let AI help us generate a simple dashboard demo first. + + + +It can be found that it is completely incorrect because DeepSeek uses data from 2023, and VStory had not been released at that time, so it does not know how to use it. At this point, we need to let it read the documentation to learn. + +### Inject Docs + +We solve this problem by injecting docs. + +Enter the Cursor settings page, select `Features`, add new docs, the docs address is https://visactor.com/vstory/guide/tutorial_docs/VStory_Website_Guide; you can also directly add through @Docs on the editing page. + + + +### Experimental Results + +By editing again with the newly added docs, the correct result can be obtained! + + + + + +**Since VStory uses VChart, VTable, and VRender, to achieve better results, you should add the documentation of VChart, VTable, and VRender to the context simultaneously.** + +# Simple Summary + +1. Improve Development Efficiency + +- Quick Access: Directly access VisActor API documentation through Cursor + +- Intelligent Suggestions: Precise code completion based on VisActor documentation + +2. Enhance Development Experience + +- Seamless Integration: Directly obtain VTable usage guidance in the development environment + +- Real-time Feedback: Quickly verify code effects + +3. Reduce Learning Costs + +- Documentation Assistance: Access VisActor official examples at any time + +- Code Generation: Automatically generate code that complies with VisActor standards + +4. Improve Code Quality + +- Standard Check: Ensure code complies with VTable best practices + +- Performance Optimization: Automatically generate high-performance table configurations + +# Contact Us + +GitHub: [github.com/VisActor](https://link.juejin.cn/?target=https%3A%2F%2Fgithub.com%2FVisActor) + +Leave a message on the VisActor WeChat subscription account (you can join the WeChat group through the subscription account menu): + + + +VisActor official website: [www.visactor.io/](https://link.juejin.cn/?target=https%3A%2F%2Fwww.visactor.io%2Fvtable); [www.visactor.](https://link.juejin.cn/?target=https%3A%2F%2Fwww.visactor.io%2Fvtable)com + +Feishu Group: + + + +Discord: https://discord.com/invite/3wPyxVyH6m + + +--- + +The doc is contributed by [玄魂](https://github.com/xuanhun) \ No newline at end of file diff --git a/docs/assets/guide/menu.json b/docs/assets/guide/menu.json index 4e5648e80a..75ec31578f 100644 --- a/docs/assets/guide/menu.json +++ b/docs/assets/guide/menu.json @@ -63,6 +63,13 @@ "zh": "Cursor+DeepSeek,快速上手属于你的 VChart 代码", "en": "Cursor+DeepSeek: Quick Start to Your VChart Code" } + }, + { + "path": "Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc", + "title": { + "zh": "使用 Trae Context Doc 快速上手 VisActor", + "en": "Quickly Get Started with VisActor Using Trae Context Doc" + } } ] }, diff --git a/docs/assets/guide/zh/tutorial_docs/Basic/DeepSeek_With_Cursor.md b/docs/assets/guide/zh/tutorial_docs/Basic/DeepSeek_With_Cursor.md index 2911923b56..326fc71234 100644 --- a/docs/assets/guide/zh/tutorial_docs/Basic/DeepSeek_With_Cursor.md +++ b/docs/assets/guide/zh/tutorial_docs/Basic/DeepSeek_With_Cursor.md @@ -3,7 +3,7 @@ 在前面的章节中,我们已经大致了解了一份基础 spec 的组成部分以及基础图表的具体生成。然而 VChart 因为其功能的强大和 API 的多样性,想要使用 VChart 快速实现一个复杂的图表可能较为困难,那么有没有一种简单轻松的方式,可以快速上手,无需在 API 文档中苦苦寻找呢? 答案是肯定的!得益于当前 AI 技术的飞速发展,通过 AI 工具不仅可以快速理解和掌握 VChart 的使用方法,还能显著提升编码效率,让开发者专注于创造力和业务逻辑的实现。 -这篇教程我们会通过配置`Cursor`和`DeepSeek`(可以是其他任何 AI),快速快速上手属于你的 VChart 代码! +这篇教程我们会通过配置`Cursor`和`DeepSeek`(可以是其他任何 AI,当然使用Cursor 默认的模型也是ok的,重点是自定义引入文档),快速快速上手属于你的 VChart 代码! ## 1. 前期准备 diff --git a/docs/assets/guide/zh/tutorial_docs/Basic/Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc.md b/docs/assets/guide/zh/tutorial_docs/Basic/Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc.md new file mode 100644 index 0000000000..c028f7d804 --- /dev/null +++ b/docs/assets/guide/zh/tutorial_docs/Basic/Quickly_Get_Started_with_VisActor_Using_Trae_Context_Doc.md @@ -0,0 +1,194 @@ +--- +title: 有了Trae 上下文doc功能 ,快速上手VisActor,再也不用提oncall了 + +key words: VisActor,VChart,VTable,VStrory,VMind,VGrammar,VRender,Visualization,Chart,Data,Table,Graph,Gis,LLM +--- +# 什么是Trae + +Trae(中国区: https://www.trae.com.cn/?utm_source=school&utm_medium=oncam&utm_campaign=visactor ,海外版:https://www.trae.ai/ ),致力于成为真正的 AI 工程师(The Real Al Engineer)。Trae 旗下的 AI IDE 产品,以智能生产力为核心,无缝融入你的开发流程,与你默契配合,更高质量、高效率完成每一个任务。 + + + +# 什么上下文Doc 功能 + +指定上下文可以让 AI 助手提供更精准的回答,但是大模型对一个组件的理解的实时程度是低于组件自己的官方文档的。如果我们在使用一个不熟悉的组件的时候,如果能将该组件的相关文档引入到上下文中,可以大大的提升智能化编程水平。 + + + +Trae 使用 “#” 来指定上下文。 + + + +输入“#Doc:”,可以索引文档集。 我们添加VisActor 的文档,进行测试。 目前Trae 还没有内置任何文档集,所以需要手动添加。 + +首先添加文档集: + + + + + +这里我们通过url的方式添加各组件的入口url: + +* VChart:https://www.visactor.io/vchart/ + +* VTable:https://www.visactor.io/vtable + +* VMind:https://www.visactor.io/vmind + +* .... + + + +整个过程略微缓慢,但是索引效果,明显好于 Cursor。 + + + + + +下面我们实地测试一下引用文档作为上下文是否会给编程带来实际的益处。 + +# 效果测试 + +## 创建测试项目 + +我们创建一个最简单web 项目 + +``` +npm create vite@latest my-ts-web -- --template typescript +cd my-ts-web + +``` + + +# 实践验证 + +## 新增一个线图 + +我们要求Trae 生成一段代码,在当前文件中添加一个VChart 线图。 + + + +生成的结果还是有错误的。 + + + +我们下面引入文档,看看是不是会有所改变。 + + + +重新生成的代码修复了之前的api 错误调用。 + + + +生成了一个正确的线图。 + + + +## 加大难度 + +首先我们来修改数据,显示三条线。 + + + +问题的分析和答案都比较靠谱: + + + + + +主要修改点: + +1. 重构了数据结构,使用type字段来区分不同系列 + +1. 使用seriesField来指定系列的分类字段 + +1. 每个数据点包含year(x轴)、value(y轴)和type(系列)三个字段 + + + +修改入场动画效果: + + + + + +主要修改: + +1. 添加了animation配置 + +1. appear设置入场动画为fadeIn(淡入淡出) + +1. duration设置动画持续时间为1000毫秒 + +结果如下: + + + + + +## 更多问答 + +因为有了官方文档,我们可以让Trae 回答更多类型的问题,不只是代码本身。 + +比如基本的图表概念: + + + +或者 具体用法: + + + +导航到更相关文档: + + + + + +# 简单总结 + +Trae 结合文档有如下好处: + +1. 提升开发效率 + +- 快速访问:通过Marscode直接查阅VisActor API文档 + +- 智能提示:基于VisActor文档的精准代码补全 + +2. 增强开发体验 + +- 无缝集成:在开发环境中直接获取VTable使用指导 + +- 实时反馈:快速验证代码效果 + +3. 降低学习成本 + +- 文档辅助:随时查阅VisActor官方示例 + +- 代码生成:自动生成符合VisActor规范的代码 + +4. 提高代码质量 + +- 规范检查:确保代码符合VisActor最佳实践 + +- 性能优化:自动生成高性能表格配置 + +# 联系我们 + +github :[github.com/VisActor](https://link.juejin.cn/?target=https%3A%2F%2Fgithub.com%2FVisActor) + +VisActor 微信订阅号留言(可以通过订阅号菜单加入微信群): + + + +VisActor 官网:[www.visactor.io/](https://link.juejin.cn/?target=https%3A%2F%2Fwww.visactor.io%2Fvtable) ; [www.visactor.](https://link.juejin.cn/?target=https%3A%2F%2Fwww.visactor.io%2Fvtable)com + +飞书群: + + + +discord:https://discord.com/invite/3wPyxVyH6m + + +--- + +The doc is contributed by [玄魂](https://github.com/xuanhun)