mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-21 11:43:56 +00:00
109 lines
3.7 KiB
TypeScript
109 lines
3.7 KiB
TypeScript
import { getPromptByVersion } from './utils';
|
||
|
||
export const Prompt_AgentQA = {
|
||
description: `<Context></Context> 标记中是一段文本,学习和分析它,并整理学习成果:
|
||
- 提出问题并给出每个问题的答案。
|
||
- 答案需详细完整,尽可能保留原文描述,可以适当扩展答案描述。
|
||
- 答案可以包含普通文字、链接、代码、表格、公示、媒体链接等 Markdown 元素。
|
||
- 最多提出 50 个问题。
|
||
- 生成的问题和答案和源文本语言相同。
|
||
`,
|
||
fixedText: `请按以下格式整理学习成果:
|
||
<Context>
|
||
文本
|
||
</Context>
|
||
Q1: 问题。
|
||
A1: 答案。
|
||
Q2:
|
||
A2:
|
||
|
||
------
|
||
|
||
我们开始吧!
|
||
|
||
<Context>
|
||
{{text}}
|
||
</Context>
|
||
`
|
||
};
|
||
|
||
export const getExtractJsonPrompt = (version?: string) => {
|
||
const promptMap: Record<string, string> = {
|
||
['4.9.2']: `你可以从 <对话记录></对话记录> 中提取指定 Json 信息,你仅需返回 Json 字符串,无需回答问题。
|
||
<提取要求>
|
||
{{description}}
|
||
</提取要求>
|
||
|
||
<提取规则>
|
||
- 本次需提取的 json 字符串,需符合 JsonSchema 的规则。
|
||
- type 代表数据类型; key 代表字段名; description 代表字段的描述; enum 是枚举值,代表可选的 value。
|
||
- 如果没有可提取的内容,忽略该字段。
|
||
</提取规则>
|
||
|
||
<JsonSchema>
|
||
{{json}}
|
||
</JsonSchema>
|
||
|
||
<对话记录>
|
||
{{text}}
|
||
</对话记录>
|
||
|
||
提取的 json 字符串:`
|
||
};
|
||
|
||
return getPromptByVersion(version, promptMap);
|
||
};
|
||
|
||
export const getExtractJsonToolPrompt = (version?: string) => {
|
||
const promptMap: Record<string, string> = {
|
||
['4.9.2']: `我正在执行一个函数,需要你提供一些参数,请以 JSON 字符串格式返回这些参数,要求:
|
||
"""
|
||
- {{description}}
|
||
- 不是每个参数都是必须生成的,如果没有合适的参数值,不要生成该参数,或返回空字符串。
|
||
- 需要结合前面的对话内容,一起生成合适的参数。
|
||
"""
|
||
|
||
本次输入内容: """{{content}}"""
|
||
`
|
||
};
|
||
|
||
return getPromptByVersion(version, promptMap);
|
||
};
|
||
|
||
export const getCQPrompt = (version?: string) => {
|
||
const promptMap: Record<string, string> = {
|
||
['4.9.2']: `请帮我执行一个"问题分类"任务,将问题分类为以下几种类型之一:
|
||
|
||
"""
|
||
{{typeList}}
|
||
"""
|
||
|
||
## 背景知识
|
||
{{systemPrompt}}
|
||
|
||
## 对话记录
|
||
{{history}}
|
||
|
||
## 开始任务
|
||
|
||
现在,我们开始分类,我会给你一个"问题",请结合背景知识和对话记录,将问题分类到对应的类型中,并返回类型ID。
|
||
|
||
问题:"{{question}}"
|
||
类型ID=
|
||
`
|
||
};
|
||
|
||
return getPromptByVersion(version, promptMap);
|
||
};
|
||
|
||
export const QuestionGuidePrompt = `You are an AI assistant tasked with predicting the user's next question based on the conversation history. Your goal is to generate 3 potential questions that will guide the user to continue the conversation. When generating these questions, adhere to the following rules:
|
||
|
||
1. Use the same language as the user's last question in the conversation history.
|
||
2. Keep each question under 20 characters in length.
|
||
|
||
Analyze the conversation history provided to you and use it as context to generate relevant and engaging follow-up questions. Your predictions should be logical extensions of the current topic or related areas that the user might be interested in exploring further.
|
||
|
||
Remember to maintain consistency in tone and style with the existing conversation while providing diverse options for the user to choose from. Your goal is to keep the conversation flowing naturally and help the user delve deeper into the subject matter or explore related topics.`;
|
||
|
||
export const QuestionGuideFooterPrompt = `Please strictly follow the format rules: \nReturn questions in JSON format: ['Question 1', 'Question 2', 'Question 3']. Your output: `;
|