"use strict"; import { readFileSync } from "node:fs"; import { join, dirname } from "node:path"; /** * 所有 system prompt 常量,从 src/prompts/*.txt 加载。 * 各 prompt 移植自官方 @z_ai/mcp-server v0.1.4。 */ const promptsDir = join(dirname(__filename), "prompts"); function load(filename: string): string { return readFileSync(join(promptsDir, filename), "utf-8"); } /** 通用图像分析 (image_analysis) */ export const GENERAL_IMAGE_ANALYSIS: string = load("general-image-analysis.txt"); /** OCR 文字提取 (extract_text_from_screenshot) */ export const TEXT_EXTRACTION: string = load("text-extraction.txt"); /** 错误诊断 (diagnose_error_screenshot) */ export const ERROR_DIAGNOSIS: string = load("error-diagnosis.txt"); /** 技术图表解读 (understand_technical_diagram) */ export const DIAGRAM_UNDERSTANDING: string = load("diagram-understanding.txt"); /** 数据可视化分析 (analyze_data_visualization) */ export const DATA_VIZ_ANALYSIS: string = load("data-viz-analysis.txt"); /** UI 差异比对 (ui_diff_check) */ export const UI_DIFF_CHECK: string = load("ui-diff-check.txt"); /** UI→代码 (ui_to_artifact, outputType="code") */ export const UI_TO_ARTIFACT_CODE: string = load("ui-to-artifact-code.txt"); /** UI→AI 提示词 (ui_to_artifact, outputType="prompt") */ export const UI_TO_ARTIFACT_PROMPT: string = load("ui-to-artifact-prompt.txt"); /** UI→设计规范 (ui_to_artifact, outputType="spec") */ export const UI_TO_ARTIFACT_SPEC: string = load("ui-to-artifact-spec.txt"); /** UI→自然语言描述 (ui_to_artifact, outputType="description") */ export const UI_TO_ARTIFACT_DESCRIPTION: string = load("ui-to-artifact-description.txt"); /** 视频内容分析 (video_analysis) */ export const VIDEO_ANALYSIS: string = load("video-analysis.txt"); /** 根据 outputType 返回对应的 UI-to-artifact prompt */ export function uiToArtifactPrompt(outputType: string): string | null { switch (outputType.toLowerCase()) { case "code": return UI_TO_ARTIFACT_CODE; case "prompt": return UI_TO_ARTIFACT_PROMPT; case "spec": return UI_TO_ARTIFACT_SPEC; case "description": return UI_TO_ARTIFACT_DESCRIPTION; default: return null; } }