mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-16 12:27:53 +08:00
chore(wiki): externalize compile prompts; doc archive tools + admin endpoints
This commit is contained in:
parent
58b49f6e20
commit
51566a47a4
@ -11,6 +11,7 @@ import org.springframework.ai.chat.model.ChatResponse;
|
|||||||
import org.springframework.ai.chat.prompt.Prompt;
|
import org.springframework.ai.chat.prompt.Prompt;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import vip.mate.agent.prompt.PromptLoader;
|
||||||
import vip.mate.wiki.job.WikiJobStep;
|
import vip.mate.wiki.job.WikiJobStep;
|
||||||
import vip.mate.wiki.job.WikiModelRoutingService;
|
import vip.mate.wiki.job.WikiModelRoutingService;
|
||||||
import vip.mate.wiki.model.WikiChunkEntity;
|
import vip.mate.wiki.model.WikiChunkEntity;
|
||||||
@ -127,17 +128,12 @@ public class WikiCompileService {
|
|||||||
throw new IllegalStateException("Refusing to compile over protected page: " + resolvedSlug);
|
throw new IllegalStateException("Refusing to compile over protected page: " + resolvedSlug);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Build LLM prompt.
|
// 3. Build LLM prompt — prompt body lives in resources/prompts/wiki/compile-{system,user}.txt
|
||||||
String system = """
|
// so we can iterate on phrasing without recompiling Java.
|
||||||
You are a wiki page compiler. Produce a single Markdown page that
|
String system = PromptLoader.loadPrompt("wiki/compile-system");
|
||||||
synthesizes the supplied evidence. Constraints:
|
String user = PromptLoader.loadPrompt("wiki/compile-user")
|
||||||
- Output ONLY a JSON object: {"title": "...", "summary": "...", "content": "..."}
|
.replace("{topic}", topic)
|
||||||
- Do not invent facts beyond the evidence.
|
.replace("{evidence}", evidenceBlock.toString());
|
||||||
- Use [[wikilinks]] when an evidence breadcrumb names a related concept.
|
|
||||||
- Keep summary <= 300 characters.
|
|
||||||
- content must be Markdown with ## headers.
|
|
||||||
""";
|
|
||||||
String user = "## Topic\n\n" + topic + "\n\n## Evidence\n\n" + evidenceBlock;
|
|
||||||
|
|
||||||
ChatModel chatModel = resolveChatModel(kbId);
|
ChatModel chatModel = resolveChatModel(kbId);
|
||||||
ChatResponse resp = chatModel.call(new Prompt(List.of(
|
ChatResponse resp = chatModel.call(new Prompt(List.of(
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
You are a wiki page compiler. Produce a single Markdown page that synthesizes the supplied evidence chunks into a coherent article on the requested topic.
|
||||||
|
|
||||||
|
Strict output contract — return ONLY this JSON object, nothing else:
|
||||||
|
{
|
||||||
|
"title": "<page title>",
|
||||||
|
"summary": "<one paragraph, <= 300 characters>",
|
||||||
|
"content": "<Markdown body with ## headers>"
|
||||||
|
}
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- Do not invent facts beyond the supplied evidence. If something is not in the evidence, do not assert it.
|
||||||
|
- Use [[wikilinks]] when an evidence breadcrumb names a related concept; alias form [[slug|display]] is fine.
|
||||||
|
- Keep summary concise (single paragraph, <= 300 characters).
|
||||||
|
- content must be Markdown with at least one ## header.
|
||||||
|
- Do not include any prose outside the JSON object.
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
## Topic
|
||||||
|
|
||||||
|
{topic}
|
||||||
|
|
||||||
|
## Evidence
|
||||||
|
|
||||||
|
{evidence}
|
||||||
Loading…
Reference in New Issue
Block a user