Skip to content

Commit

Permalink
Merge pull request #13011 from OfficeDev/zhaofeng/fix/customAPI
Browse files Browse the repository at this point in the history
fix: update prompt
  • Loading branch information
MSFT-yiz authored Jan 7, 2025
2 parents 5f20acc + 34689fd commit cda1600
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/fx-core/src/component/generator/apiSpec/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,10 +1114,14 @@ async function updatePromptForCustomApi(
chatFolder: string
): Promise<void> {
if (commonLanguages.includes(language as ProgrammingLanguage)) {
const object = `{ "path": null, "body": null, "query": null }`;
const cSharpObject = `{ "path": {}, "body": {}, "query": {} }`;
const promptFilePath = path.join(chatFolder, "skprompt.txt");
const prompt = `The following is a conversation with an AI assistant.\nThe assistant can help to call APIs for the open api spec file${
spec.info.description ? ". " + spec.info.description : "."
}\nIf the API doesn't require parameters, invoke it with default JSON object { "path": null, "body": null, "query": null }.\n\ncontext:\nAvailable actions: {{getAction}}.`;
}\nIf the API doesn't require parameters, invoke it with default JSON object ${
(language as ProgrammingLanguage) === ProgrammingLanguage.CSharp ? cSharpObject : object
}.\n\ncontext:\nAvailable actions: {{getAction}}.`;
await fs.writeFile(promptFilePath, prompt, { encoding: "utf-8", flag: "w" });
}
}
Expand Down

0 comments on commit cda1600

Please sign in to comment.