Skip to content

Commit 6ccfdfd

Browse files
authored
perf: add formula returntype prompt (#1861)
1 parent 7aa898f commit 6ccfdfd

2 files changed

Lines changed: 91 additions & 2 deletions

File tree

packages/openapi/src/formula/ai.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import { funcDefine } from './func-define';
22

3-
export const getFormulaPrompt = (prompt: string, fields: { name: string }[]) => {
3+
export const getFormulaPrompt = (
4+
prompt: string,
5+
fields: { name: string }[],
6+
includeReturnTypes?: boolean
7+
) => {
48
const context = fields.map((field) => field.name).join('\n');
59

610
// Convert function definitions to a readable format
711
const functionDocs = funcDefine
812
.map(([_name, schema]) => {
13+
if (includeReturnTypes) {
14+
return `
15+
- Definition:${schema.definition}
16+
- ReturnsType: ${schema.returnType}
17+
`;
18+
}
919
return schema.definition;
1020
})
1121
.join('\n');

0 commit comments

Comments
 (0)