generated from tailored/router-template
feat: 添加夸一下的内容
This commit is contained in:
@@ -6,7 +6,7 @@ import { logger } from '../logger.ts';
|
||||
export const cmdList: {
|
||||
category: string;
|
||||
description?: string;
|
||||
callPath?: {
|
||||
action?: {
|
||||
path?: string;
|
||||
key?: string;
|
||||
};
|
||||
@@ -14,7 +14,7 @@ export const cmdList: {
|
||||
{
|
||||
category: '指令夸人',
|
||||
description: `进行夸奖`,
|
||||
callPath: {
|
||||
action: {
|
||||
path: 'tools',
|
||||
key: 'good-job',
|
||||
},
|
||||
@@ -28,8 +28,10 @@ agent
|
||||
description: '分析文本内容,意图分析,判断对应的指令内容',
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const text = ctx.query?.text || '';
|
||||
|
||||
let text = ctx.query?.text || '';
|
||||
if (text.length > 40) {
|
||||
text = text.slice(0, 40).trim();
|
||||
}
|
||||
let result = {
|
||||
category: 'default',
|
||||
};
|
||||
@@ -51,8 +53,6 @@ ${cmdList.map((item) => `- ${item.category}: ${item.description}`).join('\n')}
|
||||
${text}
|
||||
</context>
|
||||
`;
|
||||
const now = Date.now();
|
||||
console.log('start');
|
||||
const res = await ai
|
||||
.chat(
|
||||
[
|
||||
@@ -72,7 +72,6 @@ ${text}
|
||||
return err;
|
||||
});
|
||||
|
||||
console.log('end', Date.now() - now, 'ms');
|
||||
const ans = res.choices[0]?.message?.content || '';
|
||||
if (!ans) {
|
||||
logger.error('Empty response from AI:', res);
|
||||
|
||||
Reference in New Issue
Block a user