intention-coding 0.4.9 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -549
- package/dist/services/image-analysis/analyzer.d.ts +0 -28
- package/dist/services/image-analysis/analyzer.d.ts.map +1 -1
- package/dist/services/image-analysis/index.d.ts +0 -23
- package/dist/services/image-analysis/index.d.ts.map +1 -1
- package/dist/services/integrated-generator/index.d.ts +2 -2
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -5053,9 +5053,9 @@ ${requirementSection}
|
|
|
5053
5053
|
const aiResponse = await openai_openAIService.analyzeImage({
|
|
5054
5054
|
image_base64: imageBase64,
|
|
5055
5055
|
prompt: prompt,
|
|
5056
|
-
system_prompt: "\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u56FE\u7247\u5206\u6790\u4E13\u5BB6\uFF0C\u8BF7\
|
|
5056
|
+
system_prompt: "\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u56FE\u7247\u5206\u6790\u4E13\u5BB6\uFF0C\u8BF7\u4E25\u683C\u57FA\u4E8E\u4EFB\u52A1\u6307\u4EE4\u5206\u6790\u56FE\u7247\u5185\u5BB9\uFF0C\u4E0D\u504F\u79BB\u4EFB\u52A1\u8303\u56F4\uFF0C\u4E0D\u6DFB\u52A0\u65E0\u5173\u4FE1\u606F\u3002"
|
|
5057
5057
|
});
|
|
5058
|
-
const analysisContent = this.parseAIResponse(aiResponse
|
|
5058
|
+
const analysisContent = this.parseAIResponse(aiResponse);
|
|
5059
5059
|
return analysisContent;
|
|
5060
5060
|
} catch (error) {
|
|
5061
5061
|
logger_logger.error("AI\u5206\u6790\u5931\u8D25", {
|
|
@@ -5070,83 +5070,26 @@ ${requirementSection}
|
|
|
5070
5070
|
}
|
|
5071
5071
|
}
|
|
5072
5072
|
buildAnalysisPrompt(imagePath, basicInfo, context) {
|
|
5073
|
-
const basePrompt = `\u{8BF7}\u{
|
|
5073
|
+
const basePrompt = `\u{8BF7}\u{5206}\u{6790}\u{8FD9}\u{5F20}\u{56FE}\u{7247}\u{3002}
|
|
5074
5074
|
|
|
5075
5075
|
\u{56FE}\u{7247}\u{4FE1}\u{606F}\u{FF1A}
|
|
5076
5076
|
- \u{6587}\u{4EF6}\u{540D}\u{FF1A}${external_path_namespaceObject.basename(imagePath)}
|
|
5077
5077
|
- \u{683C}\u{5F0F}\u{FF1A}${basicInfo.format.toUpperCase()}
|
|
5078
5078
|
- \u{5C3A}\u{5BF8}\u{FF1A}${basicInfo.dimensions.width} \xd7 ${basicInfo.dimensions.height} \u{50CF}\u{7D20}
|
|
5079
5079
|
- \u{6587}\u{4EF6}\u{5927}\u{5C0F}\u{FF1A}${this.formatFileSize(basicInfo.file_size)}`;
|
|
5080
|
-
const analysisRequirements = `
|
|
5081
|
-
## \u{1F3AF} \u{6838}\u{5FC3}\u{5206}\u{6790}\u{6307}\u{4EE4}
|
|
5082
|
-
\u{4F60}\u{662F}\u{4E00}\u{4E2A}\u{4E13}\u{4E1A}\u{7684}\u{56FE}\u{7247}\u{5206}\u{6790}\u{4E13}\u{5BB6}\u{FF0C}\u{8BF7}\u{4E25}\u{683C}\u{6309}\u{7167}\u{4EE5}\u{4E0B}\u{539F}\u{5219}\u{8FDB}\u{884C}\u{5206}\u{6790}\u{FF1A}
|
|
5083
|
-
|
|
5084
|
-
1. **\u{4E25}\u{683C}\u{9075}\u{5FAA}\u{4EFB}\u{52A1}\u{8981}\u{6C42}**\u{FF1A}\u{4EC5}\u{6839}\u{636E}\u{7528}\u{6237}\u{6307}\u{4EE4}\u{5206}\u{6790}\u{56FE}\u{7247}\u{5185}\u{5BB9}\u{FF0C}\u{4E0D}\u{504F}\u{79BB}\u{4EFB}\u{52A1}\u{8303}\u{56F4}
|
|
5085
|
-
2. **\u{7CBE}\u{51C6}\u{805A}\u{7126}**\u{FF1A}\u{4EC5}\u{5728}\u{7528}\u{6237}\u{6307}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{5185}\u{89E3}\u{6790}\u{56FE}\u{7247}\u{5185}\u{5BB9}\u{FF0C}\u{4E0D}\u{6DFB}\u{52A0}\u{65E0}\u{5173}\u{4FE1}\u{606F}
|
|
5086
|
-
3. **\u{5BA2}\u{89C2}\u{51C6}\u{786E}**\u{FF1A}\u{63D0}\u{4F9B}\u{6E05}\u{6670}\u{3001}\u{51C6}\u{786E}\u{7684}\u{5206}\u{6790}\u{7ED3}\u{679C}\u{FF0C}\u{4E0D}\u{8FDB}\u{884C}\u{4E3B}\u{89C2}\u{63A8}\u{6D4B}
|
|
5087
|
-
4. **\u{7B80}\u{6D01}\u{660E}\u{4E86}**\u{FF1A}\u{8F93}\u{51FA}\u{5185}\u{5BB9}\u{8981}\u{5E72}\u{51C0}\u{3001}\u{7B80}\u{6D01}\u{3001}\u{4E13}\u{4E1A}\u{FF0C}\u{907F}\u{514D}\u{5197}\u{4F59}\u{4FE1}\u{606F}
|
|
5088
|
-
|
|
5089
|
-
\u{8BF7}\u{786E}\u{4FDD}\u{4F60}\u{7684}\u{5206}\u{6790}\u{7ED3}\u{679C}\u{5B8C}\u{5168}\u{7B26}\u{5408}\u{7528}\u{6237}\u{6307}\u{4EE4}\u{8981}\u{6C42}\u{FF0C}\u{4E0D}\u{6DFB}\u{52A0}\u{4EFB}\u{4F55}\u{989D}\u{5916}\u{7684}\u{5206}\u{7C7B}\u{6216}\u{5904}\u{7406}\u{3002}`;
|
|
5090
|
-
const outputFormat = `
|
|
5091
|
-
## \u{1F4CB} \u{8F93}\u{51FA}\u{8981}\u{6C42}
|
|
5092
|
-
- \u{4F7F}\u{7528}\u{4E2D}\u{6587}\u{56DE}\u{7B54}
|
|
5093
|
-
- \u{5185}\u{5BB9}\u{51C6}\u{786E}\u{3001}\u{5BA2}\u{89C2}\u{3001}\u{4E13}\u{4E1A}
|
|
5094
|
-
- \u{4E25}\u{683C}\u{6839}\u{636E}\u{4E0A}\u{4E0B}\u{6587}\u{6307}\u{4EE4}\u{8FDB}\u{884C}\u{5206}\u{6790}
|
|
5095
|
-
- \u{53EA}\u{63D0}\u{4F9B}\u{76F4}\u{63A5}\u{7684}\u{5206}\u{6790}\u{7ED3}\u{679C}\u{FF0C}\u{4E0D}\u{8FDB}\u{884C}\u{5206}\u{7C7B}\u{5904}\u{7406}
|
|
5096
|
-
- \u{4FDD}\u{6301}\u{8F93}\u{51FA}\u{5185}\u{5BB9}\u{5E72}\u{51C0}\u{660E}\u{4E86}\u{FF0C}\u{907F}\u{514D}\u{65E0}\u{5173}\u{4FE1}\u{606F}`;
|
|
5097
5080
|
const contextPrompt = context ? `
|
|
5098
5081
|
|
|
5099
|
-
## \u{
|
|
5082
|
+
## \u{5206}\u{6790}\u{6307}\u{4EE4}
|
|
5100
5083
|
${context}
|
|
5101
5084
|
|
|
5102
|
-
\u{8BF7}\u{4E25}\u{683C}\u{6839}\u{636E}\u{4EE5}\u{4E0A}\u{
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
'ui',
|
|
5109
|
-
'design',
|
|
5110
|
-
'mockup',
|
|
5111
|
-
'wireframe',
|
|
5112
|
-
'prototype',
|
|
5113
|
-
'interface',
|
|
5114
|
-
'app',
|
|
5115
|
-
'web',
|
|
5116
|
-
'mobile'
|
|
5117
|
-
];
|
|
5118
|
-
const hasUIKeyword = uiKeywords.some((keyword)=>fileName.includes(keyword));
|
|
5119
|
-
const { width, height } = basicInfo.dimensions;
|
|
5120
|
-
const aspectRatio = width / height;
|
|
5121
|
-
const commonUIRatios = [
|
|
5122
|
-
{
|
|
5123
|
-
min: 0.4,
|
|
5124
|
-
max: 0.6
|
|
5125
|
-
},
|
|
5126
|
-
{
|
|
5127
|
-
min: 1.6,
|
|
5128
|
-
max: 2.0
|
|
5129
|
-
},
|
|
5130
|
-
{
|
|
5131
|
-
min: 0.9,
|
|
5132
|
-
max: 1.1
|
|
5133
|
-
}
|
|
5134
|
-
];
|
|
5135
|
-
const hasUIRatio = commonUIRatios.some((ratio)=>aspectRatio >= ratio.min && aspectRatio <= ratio.max);
|
|
5136
|
-
return hasUIKeyword || hasUIRatio && (width >= 300 || height >= 300);
|
|
5137
|
-
}
|
|
5138
|
-
getDetailInstruction(detailLevel) {
|
|
5139
|
-
switch(detailLevel){
|
|
5140
|
-
case types_DetailLevel.BRIEF:
|
|
5141
|
-
return "\u8BF7\u63D0\u4F9B\u7B80\u8981\u7684\u5206\u6790\u7ED3\u679C\uFF0C\u91CD\u70B9\u7A81\u51FA\u6700\u91CD\u8981\u7684\u4FE1\u606F\u3002";
|
|
5142
|
-
case types_DetailLevel.COMPREHENSIVE:
|
|
5143
|
-
return "\u8BF7\u63D0\u4F9B\u5168\u9762\u8BE6\u7EC6\u7684\u5206\u6790\u7ED3\u679C\uFF0C\u5305\u542B\u6240\u6709\u53EF\u80FD\u7684\u7EC6\u8282\u548C\u4E13\u4E1A\u89C1\u89E3\u3002";
|
|
5144
|
-
case types_DetailLevel.DETAILED:
|
|
5145
|
-
default:
|
|
5146
|
-
return "\u8BF7\u63D0\u4F9B\u8BE6\u7EC6\u7684\u5206\u6790\u7ED3\u679C\uFF0C\u5305\u542B\u4E3B\u8981\u7279\u5F81\u548C\u91CD\u8981\u7EC6\u8282\u3002";
|
|
5147
|
-
}
|
|
5085
|
+
\u{8BF7}\u{4E25}\u{683C}\u{6839}\u{636E}\u{4EE5}\u{4E0A}\u{6307}\u{4EE4}\u{8FDB}\u{884C}\u{56FE}\u{7247}\u{5206}\u{6790}\u{FF0C}\u{4E0D}\u{504F}\u{79BB}\u{4EFB}\u{52A1}\u{8303}\u{56F4}\u{FF0C}\u{4E0D}\u{6DFB}\u{52A0}\u{65E0}\u{5173}\u{4FE1}\u{606F}\u{3002}` : '';
|
|
5086
|
+
const strictPrompt = `
|
|
5087
|
+
|
|
5088
|
+
## \u{5206}\u{6790}\u{8981}\u{6C42}
|
|
5089
|
+
\u{4F60}\u{5FC5}\u{987B}\u{4E25}\u{683C}\u{6839}\u{636E}\u{4EFB}\u{52A1}\u{6307}\u{4EE4}\u{5206}\u{6790}\u{56FE}\u{7247}\u{5185}\u{5BB9}\u{FF0C}\u{4E0D}\u{504F}\u{79BB}\u{7528}\u{6237}\u{8981}\u{6C42}\u{7684}\u{8303}\u{56F4}\u{FF0C}\u{4E0D}\u{6DFB}\u{52A0}\u{65E0}\u{5173}\u{4FE1}\u{606F}\u{3002}\u{786E}\u{4FDD}\u{5206}\u{6790}\u{7ED3}\u{679C}\u{6E05}\u{6670}\u{51C6}\u{786E}\u{FF0C}\u{53EA}\u{5305}\u{542B}\u{4E0E}\u{4EFB}\u{52A1}\u{76F8}\u{5173}\u{7684}\u{4FE1}\u{606F}\u{3002}`;
|
|
5090
|
+
return `${basePrompt}${contextPrompt}${strictPrompt}`.trim();
|
|
5148
5091
|
}
|
|
5149
|
-
parseAIResponse(aiResponse
|
|
5092
|
+
parseAIResponse(aiResponse) {
|
|
5150
5093
|
if (!aiResponse || 'string' != typeof aiResponse) throw new ImageAnalysisError("AI\u670D\u52A1\u8FD4\u56DE\u65E0\u6548\u54CD\u5E94", types_AnalysisErrorCodes.AI_SERVICE_ERROR, {
|
|
5151
5094
|
aiResponse
|
|
5152
5095
|
});
|
|
@@ -5180,36 +5123,6 @@ ${context}
|
|
|
5180
5123
|
cleaned = cleaned.replace(/\n{3,}/g, '\n\n').trim();
|
|
5181
5124
|
return cleaned;
|
|
5182
5125
|
}
|
|
5183
|
-
extractDetails(response) {
|
|
5184
|
-
const details = {};
|
|
5185
|
-
const sections = response.split(/\n(?=[0-9]+\.|[一二三四五六七八九十]+\.|[*-]|\*\*)/);
|
|
5186
|
-
sections.forEach((section, index)=>{
|
|
5187
|
-
const trimmedSection = section.trim();
|
|
5188
|
-
if (trimmedSection.length > 10) {
|
|
5189
|
-
const title = this.extractSectionTitle(trimmedSection);
|
|
5190
|
-
if (title) details[title] = trimmedSection;
|
|
5191
|
-
else details[`section_${index + 1}`] = trimmedSection;
|
|
5192
|
-
}
|
|
5193
|
-
});
|
|
5194
|
-
return details;
|
|
5195
|
-
}
|
|
5196
|
-
extractSectionTitle(section) {
|
|
5197
|
-
const titlePatterns = [
|
|
5198
|
-
/^\*\*(.*?)\*\*/,
|
|
5199
|
-
/^[0-9]+\.\s*(.*?)[::]/,
|
|
5200
|
-
/^[一二三四五六七八九十]+\.\s*(.*?)[::]/,
|
|
5201
|
-
/^[*-]\s*(.*?)[::]/,
|
|
5202
|
-
/^(.*?)[::]/
|
|
5203
|
-
];
|
|
5204
|
-
for (const pattern of titlePatterns){
|
|
5205
|
-
const match = section.match(pattern);
|
|
5206
|
-
if (match && match[1]) {
|
|
5207
|
-
const title = match[1].trim();
|
|
5208
|
-
if (title.length > 0 && title.length < 50) return title;
|
|
5209
|
-
}
|
|
5210
|
-
}
|
|
5211
|
-
return null;
|
|
5212
|
-
}
|
|
5213
5126
|
async getImageBasicInfo(imagePath) {
|
|
5214
5127
|
try {
|
|
5215
5128
|
const metadata = await external_sharp_default()(imagePath).metadata();
|
|
@@ -5285,132 +5198,6 @@ ${context}
|
|
|
5285
5198
|
if (content.text_content && content.text_content.length > 0) score += 0.1;
|
|
5286
5199
|
return Math.min(score, 1.0);
|
|
5287
5200
|
}
|
|
5288
|
-
extractTags(text) {
|
|
5289
|
-
const tags = [];
|
|
5290
|
-
const tagPatterns = [
|
|
5291
|
-
/标签[::]\s*([^\n]+)/gi,
|
|
5292
|
-
/关键词[::]\s*([^\n]+)/gi,
|
|
5293
|
-
/tags[::]\s*([^\n]+)/gi
|
|
5294
|
-
];
|
|
5295
|
-
for (const pattern of tagPatterns){
|
|
5296
|
-
const matches = text.matchAll(pattern);
|
|
5297
|
-
for (const match of matches){
|
|
5298
|
-
const tagString = match[1];
|
|
5299
|
-
const extractedTags = tagString.split(/[,,、]/).map((tag)=>tag.trim()).filter(Boolean);
|
|
5300
|
-
tags.push(...extractedTags);
|
|
5301
|
-
}
|
|
5302
|
-
}
|
|
5303
|
-
const conceptPatterns = [
|
|
5304
|
-
/(?:这是|这张图片是|图片显示|可以看到).*?([\u4e00-\u9fff]{2,8})/g,
|
|
5305
|
-
/(?:主要|主要内容|核心|重点).*?([\u4e00-\u9fff]{2,8})/g,
|
|
5306
|
-
/(?:包含|含有|具有).*?([\u4e00-\u9fff]{2,8})/g
|
|
5307
|
-
];
|
|
5308
|
-
for (const pattern of conceptPatterns){
|
|
5309
|
-
const matches = text.matchAll(pattern);
|
|
5310
|
-
for (const match of matches){
|
|
5311
|
-
const concept = match[1].trim();
|
|
5312
|
-
if (concept && concept.length >= 2 && concept.length <= 8) tags.push(concept);
|
|
5313
|
-
}
|
|
5314
|
-
}
|
|
5315
|
-
const typeKeywords = [
|
|
5316
|
-
"\u7167\u7247",
|
|
5317
|
-
"\u56FE\u7247",
|
|
5318
|
-
"\u622A\u56FE",
|
|
5319
|
-
"\u8BBE\u8BA1\u7A3F",
|
|
5320
|
-
'UI',
|
|
5321
|
-
"\u754C\u9762",
|
|
5322
|
-
"\u7F51\u9875",
|
|
5323
|
-
"\u5E94\u7528",
|
|
5324
|
-
'APP',
|
|
5325
|
-
"\u98CE\u666F",
|
|
5326
|
-
"\u4EBA\u7269",
|
|
5327
|
-
"\u5EFA\u7B51",
|
|
5328
|
-
"\u52A8\u7269",
|
|
5329
|
-
"\u690D\u7269",
|
|
5330
|
-
"\u98DF\u7269",
|
|
5331
|
-
"\u8F66\u8F86",
|
|
5332
|
-
"\u6587\u6863",
|
|
5333
|
-
"\u56FE\u8868",
|
|
5334
|
-
"\u624B\u673A",
|
|
5335
|
-
"\u7535\u8111",
|
|
5336
|
-
"\u5E73\u677F",
|
|
5337
|
-
"\u5C4F\u5E55",
|
|
5338
|
-
"\u6309\u94AE",
|
|
5339
|
-
"\u83DC\u5355",
|
|
5340
|
-
"\u5BFC\u822A",
|
|
5341
|
-
"\u8868\u5355"
|
|
5342
|
-
];
|
|
5343
|
-
for (const keyword of typeKeywords)if (text.includes(keyword)) tags.push(keyword);
|
|
5344
|
-
const uniqueTags = [
|
|
5345
|
-
...new Set(tags)
|
|
5346
|
-
];
|
|
5347
|
-
return uniqueTags.slice(0, 10);
|
|
5348
|
-
}
|
|
5349
|
-
extractObjects(text) {
|
|
5350
|
-
return [];
|
|
5351
|
-
}
|
|
5352
|
-
extractTextContent(text) {
|
|
5353
|
-
const textContents = [];
|
|
5354
|
-
const textPatterns = [
|
|
5355
|
-
/(?:文字内容|文本内容|识别.*?文字|包含.*?文字)[::]\s*(.*?)(?=\n\n|\n[0-9]|\n[一二三四五六七八九十]|\n[*-]|$)/gs,
|
|
5356
|
-
/(?:标题|文字|文本).*?[""]([^""]+)[""].*?/g,
|
|
5357
|
-
/(?:写着|显示|标注|文字为)[::]?\s*[""]?([^""。\n]+)[""]?/g,
|
|
5358
|
-
/[""]([^""]{5,50})[""](?=.*?(?:文字|文本|标题|内容))/g
|
|
5359
|
-
];
|
|
5360
|
-
for (const pattern of textPatterns){
|
|
5361
|
-
let match;
|
|
5362
|
-
while(null !== (match = pattern.exec(text))){
|
|
5363
|
-
const extractedText = match[1]?.trim();
|
|
5364
|
-
if (extractedText && extractedText.length > 2) textContents.push({
|
|
5365
|
-
text: extractedText,
|
|
5366
|
-
confidence: 0.8,
|
|
5367
|
-
language: this.detectLanguage(extractedText)
|
|
5368
|
-
});
|
|
5369
|
-
}
|
|
5370
|
-
}
|
|
5371
|
-
const uniqueTexts = textContents.filter((item, index, self)=>index === self.findIndex((t)=>t.text === item.text));
|
|
5372
|
-
return uniqueTexts.slice(0, 10);
|
|
5373
|
-
}
|
|
5374
|
-
detectLanguage(text) {
|
|
5375
|
-
const chineseChars = (text.match(/[\u4e00-\u9fff]/g) || []).length;
|
|
5376
|
-
const totalChars = text.length;
|
|
5377
|
-
if (chineseChars / totalChars > 0.3) return "\u4E2D\u6587";
|
|
5378
|
-
if (/^[a-zA-Z\s\d.,!?;:'"()-]+$/.test(text)) return "\u82F1\u6587";
|
|
5379
|
-
return "\u6DF7\u5408";
|
|
5380
|
-
}
|
|
5381
|
-
extractSceneInfo(text) {
|
|
5382
|
-
return {};
|
|
5383
|
-
}
|
|
5384
|
-
extractPeopleInfo(text) {
|
|
5385
|
-
return [];
|
|
5386
|
-
}
|
|
5387
|
-
extractTechnicalInfo(text) {
|
|
5388
|
-
return {};
|
|
5389
|
-
}
|
|
5390
|
-
extractUIDesignInfo(text) {
|
|
5391
|
-
const uiInfo = {
|
|
5392
|
-
layout_type: this.extractValue(text, /布局类型[::]\s*([^\n]+)/i) || "\u672A\u8BC6\u522B",
|
|
5393
|
-
components: this.extractUIComponents(text),
|
|
5394
|
-
color_scheme: this.extractColorScheme(text),
|
|
5395
|
-
typography: this.extractTypography(text),
|
|
5396
|
-
navigation: this.extractNavigation(text),
|
|
5397
|
-
responsive_design: this.extractBoolean(text, /响应式|自适应/i),
|
|
5398
|
-
design_patterns: this.extractList(text, /设计模式[::]\s*([^\n]+)/i),
|
|
5399
|
-
accessibility_features: this.extractList(text, /可访问性[::]\s*([^\n]+)/i)
|
|
5400
|
-
};
|
|
5401
|
-
return uiInfo;
|
|
5402
|
-
}
|
|
5403
|
-
extractRequirementInfo(text) {
|
|
5404
|
-
const reqInfo = {
|
|
5405
|
-
functional_requirements: this.extractFunctionalRequirements(text),
|
|
5406
|
-
non_functional_requirements: this.extractNonFunctionalRequirements(text),
|
|
5407
|
-
user_stories: this.extractUserStories(text),
|
|
5408
|
-
business_rules: this.extractList(text, /业务规则[::]\s*([^\n]+)/i),
|
|
5409
|
-
constraints: this.extractList(text, /约束条件[::]\s*([^\n]+)/i),
|
|
5410
|
-
assumptions: this.extractList(text, /假设条件[::]\s*([^\n]+)/i)
|
|
5411
|
-
};
|
|
5412
|
-
return reqInfo;
|
|
5413
|
-
}
|
|
5414
5201
|
extractValue(text, pattern) {
|
|
5415
5202
|
const match = text.match(pattern);
|
|
5416
5203
|
return match ? match[1].trim() : null;
|
|
@@ -5547,19 +5334,16 @@ ${context}
|
|
|
5547
5334
|
}
|
|
5548
5335
|
const ImageAnalysisParamsSchema = objectType({
|
|
5549
5336
|
image_path: stringType().min(1).describe("\u56FE\u7247\u6587\u4EF6\u8DEF\u5F84"),
|
|
5550
|
-
output_path: stringType().optional().describe("\u8F93\u51FA\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4E0D\u6307\u5B9A\u5219\u8F93\u51FA\u5230\u3010\u5F53\u524D\u5DE5\u7A0B\u3011/.aico/image-recognition\u76EE\u5F55"),
|
|
5551
5337
|
context: stringType().optional().describe("\u4E0A\u4E0B\u6587\u5185\u5BB9\uFF0C\u7528\u4E8E\u6307\u5BFC\u56FE\u7247\u5206\u6790\u7684\u65B9\u5411\u548C\u8303\u56F4")
|
|
5552
5338
|
});
|
|
5553
5339
|
const read_imageTool = {
|
|
5554
5340
|
name: "read_image",
|
|
5555
|
-
description: "\u4E13\u4E1A\u56FE\u7247\u5185\u5BB9\u5206\u6790\u5DE5\u5177\uFF0C\u63D0\u4F9B\
|
|
5341
|
+
description: "\u4E13\u4E1A\u56FE\u7247\u5185\u5BB9\u5206\u6790\u5DE5\u5177\uFF0C\u63D0\u4F9B\u7CBE\u786E\u7684\u56FE\u7247\u5185\u5BB9\u8BC6\u522B\u3002\u6839\u636E\u7528\u6237\u8F93\u5165\u7684\u4E0A\u4E0B\u6587\u4FE1\u606F\u548C\u56FE\u7247\u5185\u5BB9\uFF0C\u8FDB\u884C\u4E25\u683C\u57FA\u4E8E\u4EFB\u52A1\u6307\u4EE4\u7684\u5206\u6790\uFF0C\u4E0D\u504F\u79BB\u4EFB\u52A1\u8303\u56F4\uFF0C\u8F93\u51FA\u6E05\u6670\u51C6\u786E\u7684\u5206\u6790\u7ED3\u679C\u3002",
|
|
5556
5342
|
inputSchema: {
|
|
5557
5343
|
image_path: stringType().min(1).describe("\u56FE\u7247\u6587\u4EF6\u8DEF\u5F84"),
|
|
5558
|
-
output_path: stringType().optional().describe("\u8F93\u51FA\u6587\u4EF6\u8DEF\u5F84\uFF0C\u4E0D\u6307\u5B9A\u5219\u8F93\u51FA\u5230\u3010\u5F53\u524D\u5DE5\u7A0B\u3011/.aico/image-recognition\u76EE\u5F55"),
|
|
5559
5344
|
context: stringType().optional().describe("\u4E0A\u4E0B\u6587\u5185\u5BB9\uFF0C\u7528\u4E8E\u6307\u5BFC\u56FE\u7247\u5206\u6790\u7684\u65B9\u5411\u548C\u8303\u56F4")
|
|
5560
5345
|
},
|
|
5561
5346
|
handler: async (args)=>{
|
|
5562
|
-
initializeProjectRoot();
|
|
5563
5347
|
const analyzer = new ImageAnalyzer();
|
|
5564
5348
|
try {
|
|
5565
5349
|
logger_logger.info("\u56FE\u7247\u5185\u5BB9\u7406\u89E3\u667A\u80FD\u4F53\u5F00\u59CB\u6267\u884C", {
|
|
@@ -5567,59 +5351,24 @@ ${context}
|
|
|
5567
5351
|
});
|
|
5568
5352
|
const validatedArgs = ImageAnalysisParamsSchema.parse(args);
|
|
5569
5353
|
const result = await analyzer.analyzeImage(validatedArgs.image_path, validatedArgs.context);
|
|
5570
|
-
const outputPath = await generateOutputFile(result, validatedArgs.image_path, validatedArgs.output_path);
|
|
5571
|
-
formatAnalysisResult(result, validatedArgs);
|
|
5572
|
-
logger_logger.info("\u56FE\u7247\u5185\u5BB9\u7406\u89E3\u667A\u80FD\u4F53\u6267\u884C\u5B8C\u6210", {
|
|
5573
|
-
imagePath: validatedArgs.image_path,
|
|
5574
|
-
outputPath,
|
|
5575
|
-
confidenceScore: result.confidence_score,
|
|
5576
|
-
processingTime: result.processing_time_ms
|
|
5577
|
-
});
|
|
5578
5354
|
return {
|
|
5579
5355
|
content: [
|
|
5580
5356
|
{
|
|
5581
5357
|
type: "text",
|
|
5582
|
-
text: `\u{
|
|
5358
|
+
text: `\u{56FE}\u{7247}\u{5185}\u{5BB9}\u{5206}\u{6790}\u{5B8C}\u{6210}
|
|
5583
5359
|
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
-
|
|
5587
|
-
-
|
|
5588
|
-
-
|
|
5589
|
-
- **\u{5206}\u{6790}\u{7C7B}\u{578B}**: ${getAnalysisTypeLabel(result.analysis_type)}
|
|
5590
|
-
- **\u{8BE6}\u{7EC6}\u{7A0B}\u{5EA6}**: ${getDetailLevelLabel(result.detail_level)}
|
|
5591
|
-
|
|
5592
|
-
## \u{1F4C1} \u{8F93}\u{51FA}\u{6587}\u{4EF6}
|
|
5593
|
-
|
|
5594
|
-
- **\u{5206}\u{6790}\u{62A5}\u{544A}**: ${outputPath}
|
|
5595
|
-
- **\u{6587}\u{4EF6}\u{5927}\u{5C0F}**: ${await getFileSize(outputPath)}
|
|
5596
|
-
|
|
5597
|
-
## \u{23F1}\u{FE0F} \u{6027}\u{80FD}\u{7EDF}\u{8BA1}
|
|
5598
|
-
|
|
5599
|
-
- **\u{5904}\u{7406}\u{65F6}\u{95F4}**: ${result.processing_time_ms}ms
|
|
5600
|
-
- **\u{7F6E}\u{4FE1}\u{5EA6}**: ${result.confidence_score ? (100 * result.confidence_score).toFixed(1) + '%' : "\u672A\u8BC4\u4F30"}
|
|
5601
|
-
|
|
5602
|
-
## \u{1F4CB} \u{5185}\u{5BB9}\u{6982}\u{8FF0}
|
|
5360
|
+
\u{5206}\u{6790}\u{7ED3}\u{679C}\u{FF1A}
|
|
5361
|
+
- \u{56FE}\u{7247}\u{6587}\u{4EF6}\u{FF1A}${external_path_namespaceObject.basename(validatedArgs.image_path)}
|
|
5362
|
+
- \u{56FE}\u{7247}\u{5C3A}\u{5BF8}\u{FF1A}${result.basic_info.dimensions.width} \xd7 ${result.basic_info.dimensions.height} \u{50CF}\u{7D20}
|
|
5363
|
+
- \u{6587}\u{4EF6}\u{5927}\u{5C0F}\u{FF1A}${formatFileSize(result.basic_info.file_size)}
|
|
5364
|
+
- \u{5904}\u{7406}\u{65F6}\u{95F4}\u{FF1A}${result.processing_time_ms}ms
|
|
5603
5365
|
|
|
5366
|
+
\u{56FE}\u{7247}\u{63CF}\u{8FF0}\u{FF1A}
|
|
5604
5367
|
${result.content.summary}
|
|
5605
5368
|
|
|
5606
|
-
${result.content.tags && result.content.tags.length > 0 ? `
|
|
5607
|
-
## \u{1F3F7}\u{FE0F} \u{5173}\u{952E}\u{6807}\u{7B7E}
|
|
5608
|
-
${result.content.tags.map((tag)=>`\`${tag}\``).join(' ')}
|
|
5609
|
-
` : ''}
|
|
5610
|
-
|
|
5611
|
-
\u{5206}\u{6790}\u{62A5}\u{544A}\u{5DF2}\u{4FDD}\u{5B58}\u{FF0C}\u{53EF}\u{4EE5}\u{67E5}\u{770B}\u{8BE6}\u{7EC6}\u{5185}\u{5BB9}\u{3002}`
|
|
5369
|
+
${result.content.tags && result.content.tags.length > 0 ? `\u{5173}\u{952E}\u{6807}\u{7B7E}\u{FF1A}${result.content.tags.map((tag)=>`\`${tag}\``).join(' ')}` : ''}`
|
|
5612
5370
|
}
|
|
5613
|
-
]
|
|
5614
|
-
metadata: {
|
|
5615
|
-
actions: [
|
|
5616
|
-
{
|
|
5617
|
-
type: "open_file",
|
|
5618
|
-
path: outputPath,
|
|
5619
|
-
description: "\u67E5\u770B\u5206\u6790\u62A5\u544A"
|
|
5620
|
-
}
|
|
5621
|
-
]
|
|
5622
|
-
}
|
|
5371
|
+
]
|
|
5623
5372
|
};
|
|
5624
5373
|
} catch (error) {
|
|
5625
5374
|
logger_logger.error("\u56FE\u7247\u5185\u5BB9\u7406\u89E3\u667A\u80FD\u4F53\u6267\u884C\u5931\u8D25", {
|
|
@@ -5647,261 +5396,6 @@ ${result.content.tags.map((tag)=>`\`${tag}\``).join(' ')}
|
|
|
5647
5396
|
}
|
|
5648
5397
|
}
|
|
5649
5398
|
};
|
|
5650
|
-
async function generateOutputFile(result, imagePath, outputPath) {
|
|
5651
|
-
try {
|
|
5652
|
-
let finalOutputPath;
|
|
5653
|
-
if (outputPath) {
|
|
5654
|
-
finalOutputPath = outputPath;
|
|
5655
|
-
const outputDir = external_path_namespaceObject.dirname(finalOutputPath);
|
|
5656
|
-
await promises_namespaceObject.mkdir(outputDir, {
|
|
5657
|
-
recursive: true
|
|
5658
|
-
});
|
|
5659
|
-
} else {
|
|
5660
|
-
const baseDir = config_getStorageDir();
|
|
5661
|
-
const dateDir = new Date().toISOString().split('T')[0];
|
|
5662
|
-
const outputDirectory = external_path_namespaceObject.join(baseDir, 'image-recognition', dateDir);
|
|
5663
|
-
await promises_namespaceObject.mkdir(outputDirectory, {
|
|
5664
|
-
recursive: true
|
|
5665
|
-
});
|
|
5666
|
-
const timestamp = new Date().toTimeString().slice(0, 8).replace(/:/g, '');
|
|
5667
|
-
const imageBaseName = external_path_namespaceObject.basename(imagePath, external_path_namespaceObject.extname(imagePath));
|
|
5668
|
-
const fileName = `${imageBaseName}_analysis_${timestamp}.md`;
|
|
5669
|
-
finalOutputPath = external_path_namespaceObject.join(outputDirectory, fileName);
|
|
5670
|
-
}
|
|
5671
|
-
const reportContent = generateAnalysisReport(result, imagePath);
|
|
5672
|
-
await promises_namespaceObject.writeFile(finalOutputPath, reportContent, 'utf8');
|
|
5673
|
-
logger_logger.info("\u5206\u6790\u62A5\u544A\u5DF2\u751F\u6210", {
|
|
5674
|
-
outputPath: finalOutputPath,
|
|
5675
|
-
fileSize: await getFileSize(finalOutputPath)
|
|
5676
|
-
});
|
|
5677
|
-
return finalOutputPath;
|
|
5678
|
-
} catch (error) {
|
|
5679
|
-
logger_logger.error("\u751F\u6210\u8F93\u51FA\u6587\u4EF6\u5931\u8D25", {
|
|
5680
|
-
error,
|
|
5681
|
-
imagePath,
|
|
5682
|
-
outputPath
|
|
5683
|
-
});
|
|
5684
|
-
throw new ImageAnalysisError(`\u{751F}\u{6210}\u{8F93}\u{51FA}\u{6587}\u{4EF6}\u{5931}\u{8D25}: ${error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"}`, types_AnalysisErrorCodes.ANALYSIS_FAILED, {
|
|
5685
|
-
imagePath,
|
|
5686
|
-
outputPath,
|
|
5687
|
-
error
|
|
5688
|
-
});
|
|
5689
|
-
}
|
|
5690
|
-
}
|
|
5691
|
-
function generateAnalysisReport(result, imagePath) {
|
|
5692
|
-
const { basic_info, content, processing_time_ms, confidence_score, analysis_type, detail_level } = result;
|
|
5693
|
-
return `# \u{1F50D} \u{56FE}\u{7247}\u{5185}\u{5BB9}\u{7406}\u{89E3}\u{5206}\u{6790}\u{62A5}\u{544A}
|
|
5694
|
-
|
|
5695
|
-
## \u{1F4CA} \u{57FA}\u{672C}\u{4FE1}\u{606F}
|
|
5696
|
-
|
|
5697
|
-
- **\u{56FE}\u{7247}\u{8DEF}\u{5F84}**: \`${basic_info.path}\`
|
|
5698
|
-
- **\u{539F}\u{59CB}\u{6587}\u{4EF6}**: \`${external_path_namespaceObject.basename(imagePath)}\`
|
|
5699
|
-
- **\u{56FE}\u{7247}\u{683C}\u{5F0F}**: ${basic_info.format.toUpperCase()}
|
|
5700
|
-
- **\u{56FE}\u{7247}\u{5C3A}\u{5BF8}**: ${basic_info.dimensions.width} \xd7 ${basic_info.dimensions.height} \u{50CF}\u{7D20}
|
|
5701
|
-
- **\u{6587}\u{4EF6}\u{5927}\u{5C0F}**: ${formatFileSize(basic_info.file_size)}
|
|
5702
|
-
- **\u{989C}\u{8272}\u{7A7A}\u{95F4}**: ${basic_info.color_space || "\u672A\u77E5"}
|
|
5703
|
-
- **\u{900F}\u{660E}\u{901A}\u{9053}**: ${basic_info.has_alpha ? "\u662F" : "\u5426"}
|
|
5704
|
-
|
|
5705
|
-
## \u{1F3AF} \u{5206}\u{6790}\u{914D}\u{7F6E}
|
|
5706
|
-
|
|
5707
|
-
- **\u{5206}\u{6790}\u{7C7B}\u{578B}**: ${getAnalysisTypeLabel(analysis_type)}
|
|
5708
|
-
- **\u{8BE6}\u{7EC6}\u{7A0B}\u{5EA6}**: ${getDetailLevelLabel(detail_level)}
|
|
5709
|
-
- **\u{5206}\u{6790}\u{8BED}\u{8A00}**: \u{4E2D}\u{6587}
|
|
5710
|
-
- **\u{5904}\u{7406}\u{65F6}\u{95F4}**: ${processing_time_ms}ms
|
|
5711
|
-
- **\u{7F6E}\u{4FE1}\u{5EA6}**: ${confidence_score ? (100 * confidence_score).toFixed(1) + "%" : "\u672A\u8BC4\u4F30"}
|
|
5712
|
-
|
|
5713
|
-
## \u{1F4DD} \u{5206}\u{6790}\u{7ED3}\u{679C}
|
|
5714
|
-
|
|
5715
|
-
### \u{5185}\u{5BB9}\u{6982}\u{8FF0}
|
|
5716
|
-
${content.summary}
|
|
5717
|
-
|
|
5718
|
-
${content.tags && content.tags.length > 0 ? `
|
|
5719
|
-
### \u{1F3F7}\u{FE0F} \u{5173}\u{952E}\u{6807}\u{7B7E}
|
|
5720
|
-
${content.tags.map((tag)=>`\`${tag}\``).join(" ")}
|
|
5721
|
-
` : ""}
|
|
5722
|
-
|
|
5723
|
-
---
|
|
5724
|
-
|
|
5725
|
-
> **\u{5206}\u{6790}\u{539F}\u{5219}**\u{FF1A}\u{4EC5}\u{6839}\u{636E}\u{7528}\u{6237}\u{4EFB}\u{52A1}\u{6307}\u{4EE4}\u{8303}\u{56F4}\u{FF0C}\u{4E25}\u{683C}\u{5206}\u{6790}\u{56FE}\u{7247}\u{5185}\u{5BB9}\u{FF0C}\u{4E0D}\u{504F}\u{79BB}\u{4EFB}\u{52A1}\u{8981}\u{6C42}\u{FF0C}\u{8F93}\u{51FA}\u{5E72}\u{51C0}\u{660E}\u{4E86}\u{3001}\u{6E05}\u{6670}\u{51C6}\u{786E}\u{3001}\u{65E0}\u{5197}\u{4F59}\u{548C}\u{4E3B}\u{89C2}\u{63A8}\u{6D4B}\u{3002}
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
## \u{1F4A1} \u{5206}\u{6790}\u{603B}\u{7ED3}
|
|
5730
|
-
|
|
5731
|
-
\u{56FE}\u{7247}\u{5185}\u{5BB9}\u{5206}\u{6790}\u{5B8C}\u{6210}\u{FF0C}\u{5206}\u{6790}\u{8FC7}\u{7A0B}\u{4E25}\u{683C}\u{9075}\u{5FAA}\u{4EFB}\u{52A1}\u{6307}\u{4EE4}\u{8981}\u{6C42}\u{FF0C}\u{8F93}\u{51FA}\u{5185}\u{5BB9}\u{5E72}\u{51C0}\u{660E}\u{4E86}\u{3002}
|
|
5732
|
-
|
|
5733
|
-
**\u{5206}\u{6790}\u{5B8C}\u{6210}\u{65F6}\u{95F4}**: ${new Date().toLocaleString('zh-CN')}
|
|
5734
|
-
**\u{62A5}\u{544A}\u{751F}\u{6210}\u{65F6}\u{95F4}**: ${new Date().toLocaleString('zh-CN')}
|
|
5735
|
-
|
|
5736
|
-
`.trim();
|
|
5737
|
-
}
|
|
5738
|
-
async function getFileSize(filePath) {
|
|
5739
|
-
try {
|
|
5740
|
-
const stats = await promises_namespaceObject.stat(filePath);
|
|
5741
|
-
return formatFileSize(stats.size);
|
|
5742
|
-
} catch {
|
|
5743
|
-
return "\u672A\u77E5";
|
|
5744
|
-
}
|
|
5745
|
-
}
|
|
5746
|
-
function formatAnalysisResult(result, args) {
|
|
5747
|
-
const basic_info = result?.basic_info || {
|
|
5748
|
-
path: args.image_path,
|
|
5749
|
-
format: 'unknown',
|
|
5750
|
-
dimensions: {
|
|
5751
|
-
width: 0,
|
|
5752
|
-
height: 0
|
|
5753
|
-
},
|
|
5754
|
-
file_size: 0,
|
|
5755
|
-
color_space: 'unknown',
|
|
5756
|
-
has_alpha: false
|
|
5757
|
-
};
|
|
5758
|
-
const content = result?.content || {
|
|
5759
|
-
summary: "\u5206\u6790\u7ED3\u679C\u4E0D\u53EF\u7528",
|
|
5760
|
-
details: {},
|
|
5761
|
-
tags: []
|
|
5762
|
-
};
|
|
5763
|
-
const processing_time_ms = result?.processing_time_ms || 0;
|
|
5764
|
-
const confidence_score = result?.confidence_score || 0;
|
|
5765
|
-
return `
|
|
5766
|
-
# \u{1F50D} \u{56FE}\u{7247}\u{5185}\u{5BB9}\u{7406}\u{89E3}\u{5206}\u{6790}\u{62A5}\u{544A}
|
|
5767
|
-
|
|
5768
|
-
## \u{1F4CA} \u{57FA}\u{672C}\u{4FE1}\u{606F}
|
|
5769
|
-
- **\u{56FE}\u{7247}\u{8DEF}\u{5F84}**: \`${basic_info.path}\`
|
|
5770
|
-
- **\u{56FE}\u{7247}\u{683C}\u{5F0F}**: ${basic_info.format.toUpperCase()}
|
|
5771
|
-
- **\u{56FE}\u{7247}\u{5C3A}\u{5BF8}**: ${basic_info.dimensions.width} \xd7 ${basic_info.dimensions.height}
|
|
5772
|
-
- **\u{6587}\u{4EF6}\u{5927}\u{5C0F}**: ${formatFileSize(basic_info.file_size)}
|
|
5773
|
-
- **\u{989C}\u{8272}\u{7A7A}\u{95F4}**: ${basic_info.color_space || "\u672A\u77E5"}
|
|
5774
|
-
- **\u{900F}\u{660E}\u{901A}\u{9053}**: ${basic_info.has_alpha ? "\u662F" : "\u5426"}
|
|
5775
|
-
|
|
5776
|
-
## \u{1F3AF} \u{5206}\u{6790}\u{914D}\u{7F6E}
|
|
5777
|
-
- **\u{5206}\u{6790}\u{7C7B}\u{578B}**: \u{4E25}\u{683C}\u{4EFB}\u{52A1}\u{6307}\u{4EE4}\u{5206}\u{6790}
|
|
5778
|
-
- **\u{5206}\u{6790}\u{8BED}\u{8A00}**: \u{4E2D}\u{6587}
|
|
5779
|
-
- **\u{5904}\u{7406}\u{65F6}\u{95F4}**: ${processing_time_ms}ms
|
|
5780
|
-
|
|
5781
|
-
## \u{1F4DD} \u{5206}\u{6790}\u{7ED3}\u{679C}
|
|
5782
|
-
|
|
5783
|
-
${content.summary}
|
|
5784
|
-
|
|
5785
|
-
${content.tags && content.tags.length > 0 ? `
|
|
5786
|
-
### \u{1F3F7}\u{FE0F} \u{5173}\u{952E}\u{6807}\u{7B7E}
|
|
5787
|
-
${content.tags.map((tag)=>`\`${tag}\``).join(" ")}
|
|
5788
|
-
` : ""}
|
|
5789
|
-
|
|
5790
|
-
${content.objects && content.objects.length > 0 ? `
|
|
5791
|
-
### \u{1F3AF} \u{8BC6}\u{522B}\u{7269}\u{4F53}
|
|
5792
|
-
${content.objects.map((obj, index)=>`
|
|
5793
|
-
${index + 1}. **${obj.name}** (\u{7F6E}\u{4FE1}\u{5EA6}: ${(100 * obj.confidence).toFixed(1)}%)
|
|
5794
|
-
${obj.attributes ? Object.entries(obj.attributes).map(([key, value])=>`- ${key}: ${value}`).join("\n ") : ""}
|
|
5795
|
-
`).join("")}
|
|
5796
|
-
` : ""}
|
|
5797
|
-
|
|
5798
|
-
${content.text_content && content.text_content.length > 0 ? `
|
|
5799
|
-
### \u{1F4C4} \u{6587}\u{5B57}\u{5185}\u{5BB9}
|
|
5800
|
-
${content.text_content.map((text, index)=>`
|
|
5801
|
-
${index + 1}. "${text.text}" (\u{7F6E}\u{4FE1}\u{5EA6}: ${(100 * text.confidence).toFixed(1)}%)
|
|
5802
|
-
${text.language ? `- \u{8BED}\u{8A00}: ${text.language}` : ""}
|
|
5803
|
-
`).join("")}
|
|
5804
|
-
` : ""}
|
|
5805
|
-
|
|
5806
|
-
${content.scene_info ? `
|
|
5807
|
-
### \u{1F30D} \u{573A}\u{666F}\u{4FE1}\u{606F}
|
|
5808
|
-
- **\u{5730}\u{70B9}\u{7C7B}\u{578B}**: ${content.scene_info.location_type || "\u672A\u8BC6\u522B"}
|
|
5809
|
-
- **\u{73AF}\u{5883}**: ${content.scene_info.environment || "\u672A\u8BC6\u522B"}
|
|
5810
|
-
- **\u{5149}\u{7167}**: ${content.scene_info.lighting || "\u672A\u8BC6\u522B"}
|
|
5811
|
-
${content.scene_info.weather ? `- **\u{5929}\u{6C14}**: ${content.scene_info.weather}` : ""}
|
|
5812
|
-
${content.scene_info.time_of_day ? `- **\u{65F6}\u{95F4}**: ${content.scene_info.time_of_day}` : ""}
|
|
5813
|
-
${content.scene_info.mood ? `- **\u{6C1B}\u{56F4}**: ${content.scene_info.mood}` : ""}
|
|
5814
|
-
` : ""}
|
|
5815
|
-
|
|
5816
|
-
${content.people_info && content.people_info.length > 0 ? `
|
|
5817
|
-
### \u{1F465} \u{4EBA}\u{7269}\u{4FE1}\u{606F}
|
|
5818
|
-
${content.people_info.map((person, index)=>`
|
|
5819
|
-
${index + 1}. **\u{4EBA}\u{7269}${index + 1}**
|
|
5820
|
-
- \u{6570}\u{91CF}: ${person.count}
|
|
5821
|
-
${person.age_range ? `- \u{5E74}\u{9F84}: ${person.age_range}` : ""}
|
|
5822
|
-
${person.gender ? `- \u{6027}\u{522B}: ${person.gender}` : ""}
|
|
5823
|
-
${person.emotions ? `- \u{60C5}\u{7EEA}: ${person.emotions.join(", ")}` : ""}
|
|
5824
|
-
${person.activities ? `- \u{6D3B}\u{52A8}: ${person.activities.join(", ")}` : ""}
|
|
5825
|
-
${person.clothing ? `- \u{670D}\u{88C5}: ${person.clothing.join(", ")}` : ""}
|
|
5826
|
-
`).join("")}
|
|
5827
|
-
` : ""}
|
|
5828
|
-
|
|
5829
|
-
${content.technical_info ? `
|
|
5830
|
-
### \u{1F527} \u{6280}\u{672F}\u{5206}\u{6790}
|
|
5831
|
-
#### \u{8272}\u{5F69}\u{5206}\u{6790}
|
|
5832
|
-
- **\u{4E3B}\u{8272}\u{8C03}**: ${content.technical_info.color_analysis?.dominant_colors?.join(", ") || "\u672A\u5206\u6790"}
|
|
5833
|
-
- **\u{8272}\u{5F69}\u{642D}\u{914D}**: ${content.technical_info.color_analysis?.color_palette?.join(", ") || "\u672A\u5206\u6790"}
|
|
5834
|
-
- **\u{4EAE}\u{5EA6}**: ${content.technical_info.color_analysis?.brightness || "\u672A\u5206\u6790"}
|
|
5835
|
-
- **\u{5BF9}\u{6BD4}\u{5EA6}**: ${content.technical_info.color_analysis?.contrast || "\u672A\u5206\u6790"}
|
|
5836
|
-
|
|
5837
|
-
#### \u{6784}\u{56FE}\u{5206}\u{6790}
|
|
5838
|
-
- **\u{4E09}\u{5206}\u{6CD5}\u{5219}**: ${content.technical_info.composition?.rule_of_thirds ? "\u7B26\u5408" : "\u4E0D\u7B26\u5408"}
|
|
5839
|
-
- **\u{5BF9}\u{79F0}\u{6027}**: ${content.technical_info.composition?.symmetry ? "\u5BF9\u79F0" : "\u975E\u5BF9\u79F0"}
|
|
5840
|
-
- **\u{5F15}\u{5BFC}\u{7EBF}**: ${content.technical_info.composition?.leading_lines ? "\u5B58\u5728" : "\u4E0D\u5B58\u5728"}
|
|
5841
|
-
|
|
5842
|
-
#### \u{8D28}\u{91CF}\u{8BC4}\u{4F30}
|
|
5843
|
-
- **\u{6E05}\u{6670}\u{5EA6}**: ${content.technical_info.quality_metrics?.sharpness || "\u672A\u8BC4\u4F30"}
|
|
5844
|
-
- **\u{566A}\u{70B9}\u{6C34}\u{5E73}**: ${content.technical_info.quality_metrics?.noise_level || "\u672A\u8BC4\u4F30"}
|
|
5845
|
-
- **\u{66DD}\u{5149}**: ${content.technical_info.quality_metrics?.exposure || "\u672A\u8BC4\u4F30"}
|
|
5846
|
-
` : ""}
|
|
5847
|
-
|
|
5848
|
-
${content.ui_design_info ? `
|
|
5849
|
-
### \u{1F3A8} UI\u{8BBE}\u{8BA1}\u{5206}\u{6790}
|
|
5850
|
-
#### \u{5E03}\u{5C40}\u{7ED3}\u{6784}
|
|
5851
|
-
- **\u{5E03}\u{5C40}\u{7C7B}\u{578B}**: ${content.ui_design_info.layout_type}
|
|
5852
|
-
- **\u{54CD}\u{5E94}\u{5F0F}\u{8BBE}\u{8BA1}**: ${content.ui_design_info.responsive_design ? "\u652F\u6301" : "\u4E0D\u652F\u6301"}
|
|
5853
|
-
|
|
5854
|
-
#### \u{7EC4}\u{4EF6}\u{5206}\u{6790}
|
|
5855
|
-
${content.ui_design_info.components && content.ui_design_info.components.length > 0 ? content.ui_design_info.components.map((comp, index)=>`${index + 1}. **${comp.type}**: ${comp.name}`).join("\n") : "\u672A\u8BC6\u522B\u5230\u5177\u4F53\u7EC4\u4EF6"}
|
|
5856
|
-
|
|
5857
|
-
#### \u{8272}\u{5F69}\u{65B9}\u{6848}
|
|
5858
|
-
- **\u{4E3B}\u{8272}\u{8C03}**: ${content.ui_design_info.color_scheme?.primary_colors?.join(", ") || "\u672A\u8BC6\u522B"}
|
|
5859
|
-
- **\u{8F85}\u{52A9}\u{8272}**: ${content.ui_design_info.color_scheme?.secondary_colors?.join(", ") || "\u672A\u8BC6\u522B"}
|
|
5860
|
-
- **\u{80CC}\u{666F}\u{8272}**: ${content.ui_design_info.color_scheme?.background_colors?.join(", ") || "\u672A\u8BC6\u522B"}
|
|
5861
|
-
|
|
5862
|
-
#### \u{5BFC}\u{822A}\u{8BBE}\u{8BA1}
|
|
5863
|
-
- **\u{5BFC}\u{822A}\u{7C7B}\u{578B}**: ${content.ui_design_info.navigation?.type || "\u672A\u8BC6\u522B"}
|
|
5864
|
-
- **\u{5BFC}\u{822A}\u{5143}\u{7D20}**: ${content.ui_design_info.navigation?.elements?.join(", ") || "\u672A\u8BC6\u522B"}
|
|
5865
|
-
|
|
5866
|
-
#### \u{8BBE}\u{8BA1}\u{6A21}\u{5F0F}
|
|
5867
|
-
${content.ui_design_info.design_patterns && content.ui_design_info.design_patterns.length > 0 ? content.ui_design_info.design_patterns.map((pattern)=>`- ${pattern}`).join("\n") : "- \u672A\u8BC6\u522B\u5230\u7279\u5B9A\u8BBE\u8BA1\u6A21\u5F0F"}
|
|
5868
|
-
` : ""}
|
|
5869
|
-
|
|
5870
|
-
${content.requirement_info ? `
|
|
5871
|
-
### \u{1F4CB} \u{9700}\u{6C42}\u{5206}\u{6790}
|
|
5872
|
-
#### \u{529F}\u{80FD}\u{9700}\u{6C42}
|
|
5873
|
-
${content.requirement_info.functional_requirements && content.requirement_info.functional_requirements.length > 0 ? content.requirement_info.functional_requirements.map((req, index)=>`
|
|
5874
|
-
${index + 1}. **${req.title}** (\u{4F18}\u{5148}\u{7EA7}: ${req.priority})
|
|
5875
|
-
- \u{63CF}\u{8FF0}: ${req.description}
|
|
5876
|
-
- \u{7C7B}\u{522B}: ${req.category}`).join("") : "\u672A\u8BC6\u522B\u5230\u5177\u4F53\u529F\u80FD\u9700\u6C42"}
|
|
5877
|
-
|
|
5878
|
-
#### \u{975E}\u{529F}\u{80FD}\u{9700}\u{6C42}
|
|
5879
|
-
${content.requirement_info.non_functional_requirements && content.requirement_info.non_functional_requirements.length > 0 ? content.requirement_info.non_functional_requirements.map((req, index)=>`
|
|
5880
|
-
${index + 1}. **${req.type}**: ${req.description}`).join("") : "\u672A\u8BC6\u522B\u5230\u975E\u529F\u80FD\u9700\u6C42"}
|
|
5881
|
-
|
|
5882
|
-
#### \u{7528}\u{6237}\u{6545}\u{4E8B}
|
|
5883
|
-
${content.requirement_info.user_stories && content.requirement_info.user_stories.length > 0 ? content.requirement_info.user_stories.map((story, index)=>`
|
|
5884
|
-
${index + 1}. \u{4F5C}\u{4E3A} **${story.as_a}**\u{FF0C}\u{6211}\u{5E0C}\u{671B} **${story.i_want}**\u{FF0C}\u{4EE5}\u{4FBF} **${story.so_that}** (\u{4F18}\u{5148}\u{7EA7}: ${story.priority})`).join("") : "\u672A\u8BC6\u522B\u5230\u7528\u6237\u6545\u4E8B"}
|
|
5885
|
-
|
|
5886
|
-
#### \u{4E1A}\u{52A1}\u{89C4}\u{5219}
|
|
5887
|
-
${content.requirement_info.business_rules && content.requirement_info.business_rules.length > 0 ? content.requirement_info.business_rules.map((rule)=>`- ${rule}`).join("\n") : "- \u672A\u8BC6\u522B\u5230\u4E1A\u52A1\u89C4\u5219"}
|
|
5888
|
-
` : ""}
|
|
5889
|
-
|
|
5890
|
-
${Object.keys(content.details).length > 0 ? `
|
|
5891
|
-
### \u{1F4CB} \u{8BE6}\u{7EC6}\u{4FE1}\u{606F}
|
|
5892
|
-
${Object.entries(content.details).map(([key, value])=>`
|
|
5893
|
-
**${key}**: ${"object" == typeof value ? JSON.stringify(value, null, 2) : value}
|
|
5894
|
-
`).join("")}
|
|
5895
|
-
` : ""}
|
|
5896
|
-
|
|
5897
|
-
## \u{1F4A1} \u{5206}\u{6790}\u{603B}\u{7ED3}
|
|
5898
|
-
|
|
5899
|
-
\u{57FA}\u{4E8E}\u{901A}\u{7528}\u{5206}\u{6790}\u{FF0C}\u{56FE}\u{7247}\u{5185}\u{5BB9}\u{7406}\u{89E3}\u{5B8C}\u{6210}\u{3002}
|
|
5900
|
-
${confidence_score && confidence_score > 0.8 ? "\u5206\u6790\u7ED3\u679C\u7F6E\u4FE1\u5EA6\u8F83\u9AD8\uFF0C\u53EF\u4FE1\u5EA6\u826F\u597D\u3002" : ""}
|
|
5901
|
-
|
|
5902
|
-
**\u{5206}\u{6790}\u{5B8C}\u{6210}\u{65F6}\u{95F4}**: ${new Date().toISOString()}
|
|
5903
|
-
`.trim();
|
|
5904
|
-
}
|
|
5905
5399
|
function formatErrorResponse(error) {
|
|
5906
5400
|
const errorMessages = {
|
|
5907
5401
|
[types_AnalysisErrorCodes.INVALID_IMAGE_PATH]: "\u65E0\u6548\u7684\u56FE\u7247\u8DEF\u5F84",
|
|
@@ -5966,28 +5460,6 @@ ${getErrorSuggestion(error.code)}
|
|
|
5966
5460
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
5967
5461
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
|
5968
5462
|
}
|
|
5969
|
-
function getAnalysisTypeLabel(type) {
|
|
5970
|
-
const labels = {
|
|
5971
|
-
general: "\u901A\u7528\u5206\u6790",
|
|
5972
|
-
objects: "\u7269\u4F53\u8BC6\u522B",
|
|
5973
|
-
text: "\u6587\u5B57\u8BC6\u522B",
|
|
5974
|
-
scene: "\u573A\u666F\u5206\u6790",
|
|
5975
|
-
people: "\u4EBA\u7269\u5206\u6790",
|
|
5976
|
-
technical: "\u6280\u672F\u5206\u6790",
|
|
5977
|
-
ui_design: "UI\u8BBE\u8BA1\u7A3F\u5206\u6790",
|
|
5978
|
-
requirement: "\u9700\u6C42\u8BC6\u522B\u5206\u6790",
|
|
5979
|
-
custom: "\u81EA\u5B9A\u4E49\u5206\u6790"
|
|
5980
|
-
};
|
|
5981
|
-
return labels[type] || type;
|
|
5982
|
-
}
|
|
5983
|
-
function getDetailLevelLabel(level) {
|
|
5984
|
-
const labels = {
|
|
5985
|
-
brief: "\u7B80\u8981",
|
|
5986
|
-
detailed: "\u8BE6\u7EC6",
|
|
5987
|
-
comprehensive: "\u5168\u9762"
|
|
5988
|
-
};
|
|
5989
|
-
return labels[level] || level;
|
|
5990
|
-
}
|
|
5991
5463
|
function getErrorSuggestion(errorCode) {
|
|
5992
5464
|
const suggestions = {
|
|
5993
5465
|
[types_AnalysisErrorCodes.INVALID_IMAGE_PATH]: "\u8BF7\u68C0\u67E5\u56FE\u7247\u8DEF\u5F84\u662F\u5426\u6B63\u786E",
|
|
@@ -16,14 +16,6 @@ export declare class ImageAnalyzer {
|
|
|
16
16
|
* 构建分析prompt
|
|
17
17
|
*/
|
|
18
18
|
private buildAnalysisPrompt;
|
|
19
|
-
/**
|
|
20
|
-
* 检测是否为UI设计稿
|
|
21
|
-
*/
|
|
22
|
-
private detectUIDesign;
|
|
23
|
-
/**
|
|
24
|
-
* 获取详细程度指令
|
|
25
|
-
*/
|
|
26
|
-
private getDetailInstruction;
|
|
27
19
|
/**
|
|
28
20
|
* 解析AI响应
|
|
29
21
|
*/
|
|
@@ -32,14 +24,6 @@ export declare class ImageAnalyzer {
|
|
|
32
24
|
* 清理AI响应内容
|
|
33
25
|
*/
|
|
34
26
|
private cleanAIResponse;
|
|
35
|
-
/**
|
|
36
|
-
* 提取详细信息
|
|
37
|
-
*/
|
|
38
|
-
private extractDetails;
|
|
39
|
-
/**
|
|
40
|
-
* 提取章节标题
|
|
41
|
-
*/
|
|
42
|
-
private extractSectionTitle;
|
|
43
27
|
/**
|
|
44
28
|
* 获取图片基本信息
|
|
45
29
|
*/
|
|
@@ -56,18 +40,6 @@ export declare class ImageAnalyzer {
|
|
|
56
40
|
* 计算置信度分数
|
|
57
41
|
*/
|
|
58
42
|
private calculateConfidenceScore;
|
|
59
|
-
private extractTags;
|
|
60
|
-
private extractObjects;
|
|
61
|
-
private extractTextContent;
|
|
62
|
-
/**
|
|
63
|
-
* 检测语言
|
|
64
|
-
*/
|
|
65
|
-
private detectLanguage;
|
|
66
|
-
private extractSceneInfo;
|
|
67
|
-
private extractPeopleInfo;
|
|
68
|
-
private extractTechnicalInfo;
|
|
69
|
-
private extractUIDesignInfo;
|
|
70
|
-
private extractRequirementInfo;
|
|
71
43
|
private extractValue;
|
|
72
44
|
private extractBoolean;
|
|
73
45
|
private extractList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../../src/services/image-analysis/analyzer.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,cAAc,EAQf,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAmDhF;;OAEG;YACW,iBAAiB;IAkC/B;;OAEG;IACH,OAAO,CAAC,mBAAmB;
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../../src/services/image-analysis/analyzer.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,cAAc,EAQf,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,aAAa;IACxB;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAmDhF;;OAEG;YACW,iBAAiB;IAkC/B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAwB3B;;OAEG;IACH,OAAO,CAAC,eAAe;IAgCvB;;OAEG;IACH,OAAO,CAAC,eAAe;IAqBvB;;OAEG;YACW,iBAAiB;IAyB/B;;OAEG;YACW,aAAa;IAsC3B;;OAEG;YACW,cAAc;IA0B5B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,mBAAmB;IA2B3B,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,6BAA6B;IA2BrC,OAAO,CAAC,gCAAgC;IAqBxC,OAAO,CAAC,kBAAkB;IAwB1B,OAAO,CAAC,cAAc;CASvB"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
declare const ImageAnalysisParamsSchema: z.ZodObject<{
|
|
3
3
|
image_path: z.ZodString;
|
|
4
|
-
output_path: z.ZodOptional<z.ZodString>;
|
|
5
4
|
context: z.ZodOptional<z.ZodString>;
|
|
6
5
|
}, "strip", z.ZodTypeAny, {
|
|
7
6
|
image_path: string;
|
|
8
|
-
output_path?: string | undefined;
|
|
9
7
|
context?: string | undefined;
|
|
10
8
|
}, {
|
|
11
9
|
image_path: string;
|
|
12
|
-
output_path?: string | undefined;
|
|
13
10
|
context?: string | undefined;
|
|
14
11
|
}>;
|
|
15
12
|
export type ImageAnalysisToolParams = z.infer<typeof ImageAnalysisParamsSchema>;
|
|
@@ -22,25 +19,16 @@ export declare const read_imageTool: {
|
|
|
22
19
|
description: string;
|
|
23
20
|
inputSchema: {
|
|
24
21
|
image_path: z.ZodString;
|
|
25
|
-
output_path: z.ZodOptional<z.ZodString>;
|
|
26
22
|
context: z.ZodOptional<z.ZodString>;
|
|
27
23
|
};
|
|
28
24
|
handler: (args: {
|
|
29
25
|
image_path: string;
|
|
30
|
-
output_path?: string;
|
|
31
26
|
context?: string;
|
|
32
27
|
}) => Promise<{
|
|
33
28
|
content: {
|
|
34
29
|
type: string;
|
|
35
30
|
text: string;
|
|
36
31
|
}[];
|
|
37
|
-
metadata: {
|
|
38
|
-
actions: {
|
|
39
|
-
type: string;
|
|
40
|
-
path: string;
|
|
41
|
-
description: string;
|
|
42
|
-
}[];
|
|
43
|
-
};
|
|
44
32
|
isError?: undefined;
|
|
45
33
|
} | {
|
|
46
34
|
content: {
|
|
@@ -48,7 +36,6 @@ export declare const read_imageTool: {
|
|
|
48
36
|
text: string;
|
|
49
37
|
}[];
|
|
50
38
|
isError: boolean;
|
|
51
|
-
metadata?: undefined;
|
|
52
39
|
}>;
|
|
53
40
|
};
|
|
54
41
|
export declare const imageAnalysisTool: {
|
|
@@ -56,25 +43,16 @@ export declare const imageAnalysisTool: {
|
|
|
56
43
|
description: string;
|
|
57
44
|
inputSchema: {
|
|
58
45
|
image_path: z.ZodString;
|
|
59
|
-
output_path: z.ZodOptional<z.ZodString>;
|
|
60
46
|
context: z.ZodOptional<z.ZodString>;
|
|
61
47
|
};
|
|
62
48
|
handler: (args: {
|
|
63
49
|
image_path: string;
|
|
64
|
-
output_path?: string;
|
|
65
50
|
context?: string;
|
|
66
51
|
}) => Promise<{
|
|
67
52
|
content: {
|
|
68
53
|
type: string;
|
|
69
54
|
text: string;
|
|
70
55
|
}[];
|
|
71
|
-
metadata: {
|
|
72
|
-
actions: {
|
|
73
|
-
type: string;
|
|
74
|
-
path: string;
|
|
75
|
-
description: string;
|
|
76
|
-
}[];
|
|
77
|
-
};
|
|
78
56
|
isError?: undefined;
|
|
79
57
|
} | {
|
|
80
58
|
content: {
|
|
@@ -82,7 +60,6 @@ export declare const imageAnalysisTool: {
|
|
|
82
60
|
text: string;
|
|
83
61
|
}[];
|
|
84
62
|
isError: boolean;
|
|
85
|
-
metadata?: undefined;
|
|
86
63
|
}>;
|
|
87
64
|
};
|
|
88
65
|
export { ImageAnalyzer } from "./analyzer";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/image-analysis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,QAAA,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/image-analysis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,QAAA,MAAM,yBAAyB;;;;;;;;;EAI3B,CAAC;AAEL,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEhF;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;;oBASH;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;CAqD/D,CAAC;AAGF,eAAO,MAAM,iBAAiB;;;;;;;oBAxDN;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;CAwDjB,CAAC;AA4GhD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACZ,WAAW,GACZ,MAAM,SAAS,CAAC"}
|
|
@@ -22,10 +22,10 @@ export declare const IntegratedGeneratorParams: z.ZodObject<{
|
|
|
22
22
|
programming_language: string;
|
|
23
23
|
generation_type: "full_project" | "module_only" | "feature_only";
|
|
24
24
|
include_examples: boolean;
|
|
25
|
-
business_rules?: string[] | undefined;
|
|
26
25
|
framework?: string | undefined;
|
|
27
26
|
architecture_pattern?: "microservices" | "monolithic" | "layered" | "event-driven" | undefined;
|
|
28
27
|
custom_context?: string | undefined;
|
|
28
|
+
business_rules?: string[] | undefined;
|
|
29
29
|
technical_requirements?: string | undefined;
|
|
30
30
|
}, {
|
|
31
31
|
project_name: string;
|
|
@@ -33,13 +33,13 @@ export declare const IntegratedGeneratorParams: z.ZodObject<{
|
|
|
33
33
|
user_story: string;
|
|
34
34
|
acceptance_criteria: string[];
|
|
35
35
|
programming_language: string;
|
|
36
|
-
business_rules?: string[] | undefined;
|
|
37
36
|
include_tests?: boolean | undefined;
|
|
38
37
|
framework?: string | undefined;
|
|
39
38
|
architecture_pattern?: "microservices" | "monolithic" | "layered" | "event-driven" | undefined;
|
|
40
39
|
generation_type?: "full_project" | "module_only" | "feature_only" | undefined;
|
|
41
40
|
include_examples?: boolean | undefined;
|
|
42
41
|
custom_context?: string | undefined;
|
|
42
|
+
business_rules?: string[] | undefined;
|
|
43
43
|
technical_requirements?: string | undefined;
|
|
44
44
|
}>;
|
|
45
45
|
export interface IntegratedGeneratorParams {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intention-coding",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "软件工程化的需求分析,功能设计,代码编写,测试运行和发布部署",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.11.0",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@antfu/eslint-config": "^4.13.0",
|
|
50
|
+
"@biomejs/biome": "2.2.4",
|
|
50
51
|
"@esbuild-plugins/tsconfig-paths": "^0.1.2",
|
|
51
52
|
"@eslint-react/eslint-plugin": "^1.49.0",
|
|
52
53
|
"@eslint/js": "^9.26.0",
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
"tsx": "^4.19.4",
|
|
72
73
|
"typescript": "^5.8.3",
|
|
73
74
|
"typescript-eslint": "^8.32.1",
|
|
75
|
+
"ultracite": "5.4.4",
|
|
74
76
|
"vitest": "3.2.3",
|
|
75
77
|
"zod": "^3.25.76"
|
|
76
78
|
}
|