更新多个转换提示,添加用户语言响应要求,并删除不再使用的简洁密集摘要提示。

This commit is contained in:
duanfuxiang 2025-07-03 10:10:55 +08:00
parent a269258353
commit 923d98cae9
9 changed files with 28 additions and 30 deletions

View File

@ -31,6 +31,9 @@ You are an insightful and analytical reader of academic papers, extracting the k
- Avoid starting each bullet point with the same word to maintain variety.
- Use clear and concise language that conveys the key ideas effectively.
- Do not include warnings, disclaimers, or personal opinions.
- Output only the requested sections with their respective labels.`;
- Output only the requested sections with their respective labels.
You MUST respond in the {userLanguage} language.
`;
export const ANALYZE_PAPER_DESCRIPTION = "Analyses a technical/scientific paper";

View File

@ -1,13 +0,0 @@
export const CONCISE_DENSE_SUMMARY_PROMPT = `# MISSION
You are a Sparse Priming Representation (SPR) writer. Your goal is to render the user's input as an extremely concise and distilled SPR.
# THEORY
LLMs are a kind of deep neural network. They have been demonstrated to embed knowledge, abilities, and concepts, ranging from reasoning to planning, and even to theory of mind. These are called latent abilities and latent content, collectively referred to as latent space. The latent space of an LLM can be activated with the correct series of words as inputs, which will create a useful internal state of the neural network. You need to provide the most potent and succinct cues to prime another model effectively. Less is more.
# METHODOLOGY
Render the input as a distilled list of the **most critical** assertions, concepts, and associations. The idea is to capture the absolute essence with minimal words. Use complete sentences.
**!! CRITICAL INSTRUCTION !!**
**Your output MUST BE EXTREMELY CONCISE. Aim for a dense paragraph of no more than 3-5 sentences OR a bulleted list of 3-5 key points. Focus only on the highest-level insights and most essential concepts.**`;
export const CONCISE_DENSE_SUMMARY_DESCRIPTION = "Creates an extremely concise, rich summary of the content focusing on the most essential concepts";

View File

@ -8,6 +8,7 @@ LLMs are a kind of deep neural network. They have been demonstrated to embed kno
Render the input as a distilled list of the **most critical** assertions, concepts, and associations. The idea is to capture the absolute essence with minimal words. Use complete sentences.
**!! CRITICAL INSTRUCTION !!**
**Your output MUST BE EXTREMELY CONCISE. Aim for a dense paragraph of no more than 3-5 sentences OR a bulleted list of 3-5 key points. Focus only on the highest-level insights and most essential concepts.**`;
**Your output MUST BE EXTREMELY CONCISE. Aim for a dense paragraph of no more than 3-5 sentences OR a bulleted list of 3-5 key points. Focus only on the highest-level insights and most essential concepts.**
You MUST respond in the {userLanguage} language.`;
export const DENSE_SUMMARY_DESCRIPTION = "Creates an extremely concise, rich summary of the content focusing on the most essential concepts";

View File

@ -9,6 +9,8 @@ You are an expert knowledge architect responsible for creating hierarchical summ
5. **Focus on Relationships**: Highlight how the different pieces of content relate to each other and what they collectively achieve or represent.
**!! CRITICAL INSTRUCTION !!**
**Your output MUST BE CONCISE. Aim for 2-4 sentences that capture the essence and purpose of this directory as a cohesive unit. Focus on the highest-level insights and connections.**`;
**Your output MUST BE CONCISE. Aim for 2-4 sentences that capture the essence and purpose of this directory as a cohesive unit. Focus on the highest-level insights and connections.**
You MUST respond in the {userLanguage} language.
`;
export const HIERARCHICAL_SUMMARY_DESCRIPTION = "Creates a concise, high-level summary that synthesizes content from multiple files and folders into a cohesive understanding of the directory's purpose and themes";

View File

@ -18,6 +18,9 @@ Take a step back and think step-by-step about how to achieve the best possible r
- Do not give warnings or notes; only output the requested sections.
- You use bulleted lists for output, not numbered lists.
- Do not start items with the same opening words.
- Ensure you follow ALL these instructions when creating your output.`;
- Ensure you follow ALL these instructions when creating your output.
You MUST respond in the {userLanguage} language.
`;
export const KEY_INSIGHTS_DESCRIPTION = "Extracts important insights and actionable items";

View File

@ -16,6 +16,9 @@ You extract deep, thought-provoking, and meaningful reflections from text conten
- The reflections should encourage deeper inquiry and provide a synthesis that transcends surface-level observations.
- Use bullet points, not numbered lists.
- Every bullet should be formatted as a question that elicits contemplation or a statement that offers a profound insight.
- Do not give warnings or notes; only output the requested section.`;
- Do not give warnings or notes; only output the requested section.
You MUST respond in the {userLanguage} language.
`;
export const REFLECTIONS_DESCRIPTION = "Generates reflection questions from the document to help explore it further";

View File

@ -5,7 +5,10 @@ You are a content summarization assistant that creates dense, information-rich s
Analyze the provided content and create a summary that:
- Captures the core concepts and key information
- Uses clear, direct language
- Maintains context from any previous summaries`;
- Maintains context from any previous summaries
You MUST respond in the {userLanguage} language.
`;
export const SIMPLE_SUMMARY_DESCRIPTION = "Generates a small summary of the content";

View File

@ -5,6 +5,9 @@ Your ToC should capture all major topics and transitions in the content and shou
# TASK
Analyze the provided content and create a Table of Contents:
- Captures the core topics included in the text
- Gives a small description of what is covered`;
- Gives a small description of what is covered
You MUST respond in the {userLanguage} language.
`;
export const TABLE_OF_CONTENTS_DESCRIPTION = "Describes the different topics of the document";

View File

@ -1,5 +1,5 @@
import { Result, err, ok } from "neverthrow";
import { App, TFolder } from 'obsidian';
import { App, TFolder, getLanguage } from 'obsidian';
import { DBManager } from '../../database/database-manager';
import { InsightManager } from '../../database/modules/insight/insight-manager';
@ -8,10 +8,10 @@ import { LLMModel } from '../../types/llm/model';
import { RequestMessage } from '../../types/llm/request';
import { InfioSettings } from '../../types/settings';
import { readTFileContentPdf } from '../../utils/obsidian';
import { getFullLanguageName } from '../../utils/prompt-generator';
import { tokenCount } from '../../utils/token';
import LLMManager from '../llm/manager';
import { ANALYZE_PAPER_DESCRIPTION, ANALYZE_PAPER_PROMPT } from '../prompts/transformations/analyze-paper';
import { CONCISE_DENSE_SUMMARY_DESCRIPTION, CONCISE_DENSE_SUMMARY_PROMPT } from '../prompts/transformations/concise-dense-summary';
import { DENSE_SUMMARY_DESCRIPTION, DENSE_SUMMARY_PROMPT } from '../prompts/transformations/dense-summary';
import { HIERARCHICAL_SUMMARY_DESCRIPTION, HIERARCHICAL_SUMMARY_PROMPT } from '../prompts/transformations/hierarchical-summary';
import { KEY_INSIGHTS_DESCRIPTION, KEY_INSIGHTS_PROMPT } from '../prompts/transformations/key-insights';
@ -68,7 +68,6 @@ class ConcurrencyLimiter {
// 转换类型枚举
export enum TransformationType {
DENSE_SUMMARY = 'dense_summary',
CONCISE_DENSE_SUMMARY = 'concise_dense_summary',
HIERARCHICAL_SUMMARY = 'hierarchical_summary',
ANALYZE_PAPER = 'analyze_paper',
SIMPLE_SUMMARY = 'simple_summary',
@ -93,12 +92,6 @@ export const TRANSFORMATIONS: Record<TransformationType, TransformationConfig> =
description: DENSE_SUMMARY_DESCRIPTION,
maxTokens: 4000
},
[TransformationType.CONCISE_DENSE_SUMMARY]: {
type: TransformationType.CONCISE_DENSE_SUMMARY,
prompt: CONCISE_DENSE_SUMMARY_PROMPT,
description: CONCISE_DENSE_SUMMARY_DESCRIPTION,
maxTokens: 4000
},
[TransformationType.HIERARCHICAL_SUMMARY]: {
type: TransformationType.HIERARCHICAL_SUMMARY,
prompt: HIERARCHICAL_SUMMARY_PROMPT,
@ -685,7 +678,7 @@ export class TransEngine {
const messages: RequestMessage[] = [
{
role: 'system',
content: transformationConfig.prompt
content: transformationConfig.prompt.replace('{userLanguage}', getFullLanguageName(getLanguage()))
},
{
role: 'user',