1- import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
21import { useLocation } from '@docusaurus/router' ;
3- import React , { useState , useMemo , useEffect } from 'react ' ;
4- import IDESelector from './IDESelector ' ;
2+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext ' ;
3+ import React , { useEffect , useMemo , useState } from 'react ' ;
54import styles from './ErrorCodeIDEButton.module.css' ;
5+ import IDESelector from './IDESelector' ;
66import { reportEvent } from './analytics' ;
77
88// IDE list for icons (from IDESelector)
@@ -58,24 +58,22 @@ function generatePrompt(pageUrl: string, locale: string): string {
5858
5959请帮助我解决这个问题:
6060
61- 1. **建议修复方案**:分析我的代码库上下文,提出需要更改什么来解决这个错误
62-
63- 2. **解释根本原因**:分析为什么会出现这个错误:
64- - 代码实际在做什么 vs. 它需要做什么?
65- - 什么条件触发了这个特定错误?
66- - 是什么误解或疏忽导致了这个问题?
61+ 1. **分析代码库并使用 CloudBase MCP 工具解决问题**:
62+ - 深入分析我的代码库上下文,理解代码结构和相关模块
63+ - 阅读 CloudBase 的 AI rules 和 MCP 工具文档,理解问题的本质
64+ - 尝试使用 CloudBase MCP 工具(如 envQuery、login、executeReadOnlySQL 等)来诊断和解决这个问题
65+ - 如果需要修改代码,提出具体的修改方案,包括需要修改的文件、函数和代码行
6766
68- 3 . **教授概念**:帮助我理解底层原理 :
69- - 为什么这个错误存在,它保护我免受什么 ?
70- - 这个概念的正确心智模型是什么 ?
71- - 这如何融入更广泛的框架/语言设计 ?
67+ 2 . **解释根本原因** :
68+ - 代码实际在做什么 vs. 它应该做什么 ?
69+ - 什么条件或场景触发了这个特定错误 ?
70+ - 是什么误解、疏忽或不当使用导致了这个问题 ?
7271
73- 4. **展示警告信号**:帮助我在未来识别这种模式:
74- - 我应该注意什么可能导致这种情况再次发生?
75- - 在相关场景中我可能犯哪些类似的错误?
76- - 哪些代码异味或模式表明这个问题?
77-
78- 5. **讨论替代方案**:解释是否有不同的有效方法及其权衡
72+ 3. **用费曼学习法教授概念**:
73+ - 用简单易懂的语言解释底层原理,就像教一个初学者一样
74+ - 如果涉及我不熟悉的概念(如 MCP 工具、CloudBase API、框架特性等),请先解释这些基础概念
75+ - 用类比和具体例子帮助我建立正确的心智模型
76+ - 解释这个概念在整个系统中的作用和重要性
7977
8078我的目标是修复眼前的问题,同时建立持久的理解,这样我就可以在未来独立避免和解决类似的错误。` ;
8179 }
@@ -84,24 +82,22 @@ function generatePrompt(pageUrl: string, locale: string): string {
8482
8583Please help me resolve this by:
8684
87- 1. **Suggest the fix**: Analyze my codebase context and propose what needs to be changed to resolve this error
88-
89- 2. **Explain the root cause**: Break down why this error occurred:
90- - What was the code actually doing vs. what it needed to do?
91- - What conditions triggered this specific error?
92- - What misconception or oversight led to this?
93-
94- 3. **Teach the concept**: Help me understand the underlying principle:
95- - Why does this error exist and what is it protecting me from?
96- - What's the correct mental model for this concept?
97- - How does this fit into the broader framework/language design?
98-
99- 4. **Show warning signs**: Help me recognize this pattern in the future:
100- - What should I look out for that might cause this again?
101- - Are there similar mistakes I might make in related scenarios?
102- - What code smells or patterns indicate this issue?
103-
104- 5. **Discuss alternatives**: Explain if there are different valid approaches and their trade-offs
85+ 1. **Analyze codebase and solve using CloudBase MCP tools**:
86+ - Deeply analyze my codebase context to understand the code structure and related modules
87+ - Read CloudBase AI rules and MCP tools documentation to understand the root cause
88+ - Try using CloudBase MCP tools (such as envQuery, login, executeReadOnlySQL, etc.) to diagnose and solve this problem
89+ - If code changes are needed, propose specific modifications including files, functions, and code lines to modify
90+
91+ 2. **Explain the root cause**:
92+ - What was the code actually doing vs. what it should be doing?
93+ - What conditions or scenarios triggered this specific error?
94+ - What misconception, oversight, or improper usage led to this problem?
95+
96+ 3. **Teach concepts using the Feynman technique**:
97+ - Explain underlying principles in simple, accessible language, as if teaching a beginner
98+ - If unfamiliar concepts are involved (like MCP tools, CloudBase APIs, framework features, etc.), explain these fundamentals first
99+ - Use analogies and concrete examples to help me build the correct mental model
100+ - Explain how this concept fits into and matters within the broader system
105101
106102My goal is to fix the immediate issue while building lasting understanding so I can avoid and resolve similar errors independently in the future.` ;
107103}
0 commit comments