Skip to content

feat: simplify the code and optimize prompts for complex tasks - #6

Merged
tangying1027 merged 2 commits into
mainfrom
feat-simplify-prompt
Jul 18, 2025
Merged

feat: simplify the code and optimize prompts for complex tasks#6
tangying1027 merged 2 commits into
mainfrom
feat-simplify-prompt

Conversation

@interstellarmt

Copy link
Copy Markdown
Member
  • simplify the code
  • optimize prompts for complex tasks

2. Second: Extract relevant technical topics and user intent for the determined library`
}

## User Query

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

提示次变化挺多的,要不详细描述一下去掉了哪些

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看出来 generateExamplesSection 没有了

maxTopics: number,
libraryContext?: { id: AntVLibrary; name: string },
): string {
const isLibrarySpecified = !!libraryContext;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原来的分发函数太复杂了,直接在prompt里用三元表达式做处理


${outputFormatSection}

## Examples

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为有format,感觉example不是很必要,反而会增加token消耗,所以去掉了


**Your first task is to determine the most suitable AntV library for this query.**
// Get library-specific context if specified
const libraryContext = library

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prompt里避免重复引入library name和config,直接合并了


**Output the recommended library and reason before proceeding to Phase 2.**`;
}
### Phase 1: Library Detection ${library ? '(Skipped - Library Specified)' : ''}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于需要推断library的,直接填入Auto-detect,让大模型去推断,mcp里不写过多冗余的逻辑


function generateExtractionRulesSection(
maxTopics: number,
libraryContext?: { id: AntVLibrary; name: string },

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

推断 library 的冗余提示词

Comment thread src/tools/extract_antv_topic.ts
Comment thread src/tools/extract_antv_topic.ts
@hustcc

hustcc commented Jul 18, 2025

Copy link
Copy Markdown
Member

删代码,赞👍🏻~

@tangying1027
tangying1027 merged commit 518fe79 into main Jul 18, 2025
1 check passed
@tangying1027
tangying1027 deleted the feat-simplify-prompt branch July 18, 2025 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants