ai总结近期日课优化提示词
This commit is contained in:
@@ -81,17 +81,23 @@ class PromptService
|
||||
if (empty($dayDesc)) {
|
||||
$dayDesc = '寻常日';
|
||||
}
|
||||
$time = date('Y-m-d');
|
||||
$time = date('Y年m月d日');
|
||||
// 吧time变成大写的 时间
|
||||
|
||||
$time = $this->dateToChinese($time);
|
||||
// 根据$time查看今天是农历几月初几
|
||||
|
||||
$prompt = "今天是{$time}。请作为一位严厉但充满智慧的私塾先生或人生导师,根据以下用户日课数据进行分析:{$prompt}。
|
||||
请包含:
|
||||
1. 【昨昔之憾】:分析昨日未完成之事。
|
||||
2. 【今日当勉】:针对今日未完成任务的督促。
|
||||
3. 【明日之期】:对明日任务的展望。
|
||||
4. 【日课建议】:根据最近的任务安排推测最近工作是否繁重,是否需要注意身体,事业固然中药,万不可劳累过度。
|
||||
5. 【近况小结】:根据已完成的任务总结我最近在忙什么。
|
||||
{$time}:写一段文言文来作为导语。
|
||||
【昨昔之憾】:分析昨日未完成之事和可能的原因。
|
||||
【今日当勉】:针对今日未完成任务的督促指导。
|
||||
【明日之期】:对明日任务的展望。
|
||||
【日课建议】:根据最近的任务安排推测最近工作是否繁重,是否需要注意身体,事业固然中药,万不可劳累过度。
|
||||
【小结】:根据已完成的任务总结我最近在忙什么。
|
||||
提示:
|
||||
如果没有数据则是昨日没有安排日课。
|
||||
要求:文风古雅,要给出人生建议,不使用Markdown,纯文本输出。";
|
||||
如果没有数据则是昨日没有安排日课那一天就不需要分析为什么没完成。
|
||||
要求:文风古雅,不要出现大白话,不使用Markdown,md格式,纯文本输出。";
|
||||
return $prompt;
|
||||
}
|
||||
|
||||
@@ -113,4 +119,62 @@ class PromptService
|
||||
$prompt = "今天是{$toDay},{$dayDesc}。用户心中有惑:“{$question}”。请以隐世智者或禅师的口吻,结合时令节气为其解惑。包含【机锋】与【指引】。要求:不使用Markdown,纯文本输出。";
|
||||
return $prompt;
|
||||
}
|
||||
|
||||
|
||||
// 将数字转换为中文大写
|
||||
function numberToChinese($num) {
|
||||
$chineseNumbers = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
|
||||
$chineseUnits = ['', '十', '百', '千'];
|
||||
$result = '';
|
||||
|
||||
$numStr = (string)$num;
|
||||
$len = strlen($numStr);
|
||||
|
||||
for ($i = 0; $i < $len; $i++) {
|
||||
$digit = (int)$numStr[$i];
|
||||
$unit = $len - $i - 1;
|
||||
|
||||
if ($digit !== 0) {
|
||||
// 处理"一十"开头的特殊情况
|
||||
if ($unit == 1 && $digit == 1 && $i == 0) {
|
||||
$result .= '十';
|
||||
} else {
|
||||
$result .= $chineseNumbers[$digit] . $chineseUnits[$unit % 4];
|
||||
}
|
||||
} else {
|
||||
// 避免连续的零,且最后一位为零时不显示
|
||||
if ($i < $len - 1 && $numStr[$i + 1] != '0') {
|
||||
$result .= '零';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 处理日期的大写转换
|
||||
function dateToChinese($date) {
|
||||
// 使用正则表达式提取年、月、日
|
||||
preg_match('/(\d{4})年(\d{2})月(\d{2})日/', $date, $matches);
|
||||
|
||||
if (count($matches) === 4) {
|
||||
$year = $matches[1];
|
||||
$month = (int)$matches[2]; // 转换为整数去除前导零
|
||||
$day = (int)$matches[3]; // 转换为整数去除前导零
|
||||
|
||||
// 年份单独处理(四位数字)
|
||||
$yearChinese = '';
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$yearChinese .= $this->numberToChinese($year[$i]);
|
||||
}
|
||||
|
||||
// 月份和日期的特殊处理
|
||||
$monthChinese = $this->numberToChinese($month);
|
||||
$dayChinese = $this->numberToChinese($day);
|
||||
|
||||
return $yearChinese . '年' . $monthChinese . '月' . $dayChinese . '日';
|
||||
}
|
||||
|
||||
return $date;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +243,7 @@ class XunFeiAiClientV1 extends BaseClient
|
||||
// $content = str_replace('```', '', $content);
|
||||
// $content = json_decode($content, true);
|
||||
// 现在返回模拟数据
|
||||
$content = str_replace('\n\n', '\n', $content);
|
||||
return [
|
||||
'success' => true,
|
||||
'data' => $content,
|
||||
|
||||
Reference in New Issue
Block a user