Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(spec-parser): use summary for converation starter and truncate it with 50 chars #11474

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/spec-parser/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export class ConstantString {
static readonly FullDescriptionMaxLens = 4000;
static readonly CommandDescriptionMaxLens = 128;
static readonly ParameterDescriptionMaxLens = 128;
static readonly ConversationStarterMaxLens = 50;
static readonly CommandTitleMaxLens = 32;
static readonly ParameterTitleMaxLens = 32;
static readonly SMERequiredParamsMaxNum = 5;
Expand Down
9 changes: 7 additions & 2 deletions packages/spec-parser/src/manifestUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export class ManifestUpdater {
if (operationItem) {
const operationId = operationItem.operationId!;
const description = operationItem.description ?? "";
const summary = operationItem.summary;
const paramObject = operationItem.parameters as OpenAPIV3.ParameterObject[];
const requestBody = operationItem.requestBody as OpenAPIV3.ParameterObject;

Expand Down Expand Up @@ -268,8 +269,12 @@ export class ManifestUpdater {

functions.push(funcObj);
functionNames.push(operationId);
if (description) {
conversationStarters.push(description);
const conversationStarterStr = (summary ?? description)?.slice(
0,
ConstantString.ConversationStarterMaxLens
);
if (conversationStarterStr) {
conversationStarters.push(conversationStarterStr);
}
}
}
Expand Down
Loading
Loading