Skip to content

Commit 1018550

Browse files
committed
add ai qa
1 parent 13b31a5 commit 1018550

File tree

7 files changed

+289
-3
lines changed

7 files changed

+289
-3
lines changed

docs/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ function guideSidebar(): DefaultTheme.SidebarItem[] {
151151
items: [
152152
{ text: 'FAQ', link: 'best-practices/faq' },
153153
{ text: 'Performance', link: 'best-practices/performance' },
154+
{ text: 'AI Q&A Optimization', link: 'best-practices/ai-qa-optimization' },
154155
]
155156
},
156157
{
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# AI Q&A Optimization {#ai-qa-optimization}
2+
3+
When asking questions about xmake to AI assistants (such as ChatGPT, Claude, Cursor, etc.), using some techniques can help AI better understand the context and provide more accurate, higher-quality answers.
4+
5+
## Provide Reference Documentation Links
6+
7+
When asking questions, explicitly providing xmake's LLMs reference documentation link can help AI quickly understand xmake's complete API and features.
8+
9+
Reference documentation link: [https://xmake.io/llms-full.txt](https://xmake.io/llms-full.txt)
10+
11+
```
12+
Please refer to https://xmake.io/llms-full.txt before answering my question: ...
13+
```
14+
15+
Or more specifically:
16+
17+
```
18+
Please read https://xmake.io/llms-full.txt first to understand xmake's API and features, then answer:
19+
How do I configure a target that uses C++20 modules?
20+
```
21+
22+
## Provide Complete Context Information
23+
24+
When asking questions, try to provide complete context information, including:
25+
26+
- **Project Type**: Is it a C/C++ project, Swift project, or other language
27+
- **Target Platform**: Windows, Linux, macOS, Android, iOS, etc.
28+
- **Compiler**: Toolchain used (gcc, clang, msvc, etc.)
29+
- **Specific Requirements**: What functionality you want to implement or what problem you want to solve
30+
- **Error Messages**: If you encounter problems, provide complete error messages
31+
32+
Example:
33+
34+
```
35+
Please refer to https://xmake.io/llms-full.txt to help me solve the following problem:
36+
37+
Project Type: C++ project
38+
Platform: Linux
39+
Compiler: gcc-12
40+
Problem: I want to configure a target in xmake.lua that uses C++20 modules, but I don't know how to set it up.
41+
Current xmake.lua content:
42+
[Paste your xmake.lua content]
43+
```
44+
45+
## Reference Specific API Documentation
46+
47+
If the question involves specific APIs, you can reference relevant documentation links when asking:
48+
49+
```
50+
Please refer to the target-related APIs in https://xmake.io/llms-full.txt to help me configure:
51+
1. How to set the target's compilation mode (debug/release)
52+
2. How to add precompiled header file support
53+
```
54+
55+
## Provide Code Examples
56+
57+
When asking questions, if possible, provide your current code or configuration:
58+
59+
```
60+
Please refer to https://xmake.io/llms-full.txt to help me optimize the following xmake.lua configuration:
61+
62+
target("mytarget")
63+
set_kind("binary")
64+
add_files("src/*.cpp")
65+
66+
I want to add the following features:
67+
- Enable C++20 standard
68+
- Add precompiled header files
69+
- Configure different optimization options for debug and release modes
70+
```
71+
72+
## Clarify Question Type
73+
74+
When asking questions, clearly state the question type:
75+
76+
- **Configuration Question**: How to configure a certain feature
77+
- **Compilation Question**: Errors encountered during compilation
78+
- **Performance Question**: Build speed optimization
79+
- **Best Practice**: How to better use a certain feature
80+
81+
Example:
82+
83+
```
84+
Please refer to https://xmake.io/llms-full.txt. This is a configuration question:
85+
86+
I want to configure CUDA project compilation in xmake, and need:
87+
1. Specify CUDA SDK version
88+
2. Set GPU architecture
89+
3. Configure compilation options
90+
```
91+
92+
## Ask Step by Step
93+
94+
For complex questions, you can ask step by step:
95+
96+
```
97+
Please refer to https://xmake.io/llms-full.txt to help me configure step by step:
98+
99+
Step 1: How to create a basic C++ target
100+
Step 2: How to add dependency packages
101+
Step 3: How to configure cross-compilation
102+
```
103+
104+
## Verify Answer Accuracy
105+
106+
AI answers may not be completely accurate. It is recommended to:
107+
108+
1. **Consult Official Documentation**: Verify whether the APIs and usage provided by AI are correct. You can refer to the [API Reference](/api/description/specification) and [Guide](/guide/introduction)
109+
2. **Actually Test**: Actually test the configuration provided by AI in your project
110+
3. **Cross-verify**: If possible, ask questions in different ways to verify answer consistency
111+
112+
## Example: Complete Question Template
113+
114+
```
115+
Please refer to https://xmake.io/llms-full.txt to understand xmake's complete API and features.
116+
117+
Project Information:
118+
- Type: C++ project
119+
- Platform: Linux
120+
- Compiler: clang-15
121+
- Standard: C++20
122+
123+
Current Problem:
124+
I want to configure a target that uses C++20 modules, but encountered a compilation error.
125+
126+
Current Configuration:
127+
target("mymodule")
128+
set_kind("binary")
129+
set_languages("c++20")
130+
add_files("src/*.cpp")
131+
132+
Error Message:
133+
[Paste error message]
134+
135+
Please help me:
136+
1. Analyze the cause of the problem
137+
2. Provide the correct configuration method
138+
3. Give a complete example code
139+
```
140+
141+
Through the above methods, you can help AI better understand your needs and provide more accurate and useful answers.
142+

docs/posts/api-import.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Plugin Development: Import Libraries
2+
title: "Plugin Development: Import Libraries"
33
tags: [xmake, plugin, import, library, custom script]
44
date: 2016-06-09
55
author: Ruki

docs/posts/custom-option.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Advanced Feature: Custom Options
2+
title: "Advanced Feature: Custom Options"
33
tags: [xmake, custom options]
44
date: 2016-08-07
55
author: Ruki

docs/posts/custom-task.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Advanced Feature: Custom Task
2+
title: "Advanced Feature: Custom Task"
33
tags: [xmake, task, custom script, plugin]
44
date: 2016-06-09
55
author: Ruki

docs/zh/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ function guideSidebar(): DefaultTheme.SidebarItem[] {
232232
items: [
233233
{ text: '常见问题', link: 'best-practices/faq' },
234234
{ text: '性能优化', link: 'best-practices/performance' },
235+
{ text: 'AI 问答优化', link: 'best-practices/ai-qa-optimization' },
235236
]
236237
},
237238
{
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# AI 问答优化 {#ai-qa-optimization}
2+
3+
在使用 AI 助手(如 ChatGPT、Claude、Cursor 等)提问关于 xmake 的问题时,通过一些技巧可以帮助 AI 更好地理解上下文,提供更准确、更高质量的回答。
4+
5+
## 提供参考文档链接
6+
7+
在提问时,显式提供 xmake 的 LLMs 参考文档链接,可以帮助 AI 快速了解 xmake 的完整 API 和功能。
8+
9+
参考文档链接:[https://xmake.io/llms-full.txt](https://xmake.io/llms-full.txt)
10+
11+
```
12+
请参考 https://xmake.io/llms-full.txt 后,回答我的问题:...
13+
```
14+
15+
或者更具体地:
16+
17+
```
18+
请先阅读 https://xmake.io/llms-full.txt 了解 xmake 的 API 和功能,然后回答:
19+
如何配置一个使用 C++20 模块的目标?
20+
```
21+
22+
## 提供完整的上下文信息
23+
24+
在提问时,尽量提供完整的上下文信息,包括:
25+
26+
- **项目类型**:是 C/C++ 项目、Swift 项目还是其他语言
27+
- **目标平台**:Windows、Linux、macOS、Android、iOS 等
28+
- **编译器**:使用的工具链(gcc、clang、msvc 等)
29+
- **具体需求**:想要实现什么功能或解决什么问题
30+
- **错误信息**:如果遇到问题,提供完整的错误信息
31+
32+
示例:
33+
34+
```
35+
请参考 https://xmake.io/llms-full.txt,帮我解决以下问题:
36+
37+
项目类型:C++ 项目
38+
平台:Linux
39+
编译器:gcc-12
40+
问题:我想在 xmake.lua 中配置一个使用 C++20 模块的目标,但不知道如何设置。
41+
当前的 xmake.lua 内容:
42+
[粘贴你的 xmake.lua 内容]
43+
```
44+
45+
## 引用具体的 API 文档
46+
47+
如果问题涉及特定的 API,可以在提问时引用相关的文档链接:
48+
49+
```
50+
请参考 https://xmake.io/llms-full.txt 中的 target 相关 API,帮我配置:
51+
1. 如何设置目标的编译模式(debug/release)
52+
2. 如何添加预编译头文件支持
53+
```
54+
55+
## 提供代码示例
56+
57+
在提问时,如果可能,提供你当前的代码或配置:
58+
59+
```
60+
请参考 https://xmake.io/llms-full.txt,帮我优化以下 xmake.lua 配置:
61+
62+
target("mytarget")
63+
set_kind("binary")
64+
add_files("src/*.cpp")
65+
66+
我想添加以下功能:
67+
- 启用 C++20 标准
68+
- 添加预编译头文件
69+
- 配置 debug 和 release 模式的不同优化选项
70+
```
71+
72+
## 明确问题类型
73+
74+
在提问时,明确说明问题的类型:
75+
76+
- **配置问题**:如何配置某个功能
77+
- **编译问题**:编译时遇到的错误
78+
- **性能问题**:构建速度优化
79+
- **最佳实践**:如何更好地使用某个特性
80+
81+
示例:
82+
83+
```
84+
请参考 https://xmake.io/llms-full.txt,这是一个配置问题:
85+
86+
我想在 xmake 中配置 CUDA 项目的编译,需要:
87+
1. 指定 CUDA SDK 版本
88+
2. 设置 GPU 架构
89+
3. 配置编译选项
90+
```
91+
92+
## 分步骤提问
93+
94+
对于复杂的问题,可以分步骤提问:
95+
96+
```
97+
请参考 https://xmake.io/llms-full.txt,分步骤帮我配置:
98+
99+
第一步:如何创建一个基本的 C++ 目标
100+
第二步:如何添加依赖包
101+
第三步:如何配置交叉编译
102+
```
103+
104+
## 验证回答的准确性
105+
106+
AI 的回答可能不完全准确,建议:
107+
108+
1. **查阅官方文档**:验证 AI 提供的 API 和用法是否正确,可参考 [API 手册](/zh/api/description/specification)[使用指南](/zh/guide/introduction)
109+
2. **实际测试**:在项目中实际测试 AI 提供的配置
110+
3. **交叉验证**:如果可能,用不同的方式提问验证答案的一致性
111+
112+
## 示例:完整的提问模板
113+
114+
```
115+
请参考 https://xmake.io/llms-full.txt 了解 xmake 的完整 API 和功能。
116+
117+
项目信息:
118+
- 类型:C++ 项目
119+
- 平台:Linux
120+
- 编译器:clang-15
121+
- 标准:C++20
122+
123+
当前问题:
124+
我想配置一个使用 C++20 模块的目标,但遇到了编译错误。
125+
126+
当前配置:
127+
target("mymodule")
128+
set_kind("binary")
129+
set_languages("c++20")
130+
add_files("src/*.cpp")
131+
132+
错误信息:
133+
[粘贴错误信息]
134+
135+
请帮我:
136+
1. 分析问题原因
137+
2. 提供正确的配置方法
138+
3. 给出完整的示例代码
139+
```
140+
141+
通过以上方式,可以帮助 AI 更好地理解你的需求,提供更准确、更有用的回答。
142+

0 commit comments

Comments
 (0)