Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ export interface IDiagnosticInfo {
friendlyLocationBreadcrumbItems?: string[];
}

type ResourceType = 'language-generation' | 'language-understanding' | 'knowledge-base';
function generateResourcePageUrl(
rootProjectId: string,
skillId: string | null,
resourceType: ResourceType,
resourceId: string,
line = 0
) {
let uri = `/bot/${rootProjectId}`;
if (skillId !== null && skillId !== rootProjectId) {
uri += `/skill/${skillId}`;
}

return `${uri}/${resourceType}/${resourceId}/edit#L=${line}`;
}

const getFriendlyPath = (dialogPath: string | undefined, dialogs: DialogInfo[]) => {
const breadcrumb: string[] = [];
try {
Expand Down Expand Up @@ -241,12 +257,17 @@ export class LgDiagnostic extends DiagnosticInfo {

getUrl = () => {
const { rootProjectId, projectId, resourceId, diagnostic, dialogPath } = this;
let uri = `/bot/${rootProjectId}/language-generation/${resourceId}/edit#L=${diagnostic.range?.start.line || 0}`;
let uri = generateResourcePageUrl(
rootProjectId,
projectId,
'language-generation',
resourceId,
diagnostic.range?.start.line
);
//the format of item.id is lgFile#inlineTemplateId
if (dialogPath) {
uri = convertPathToUrl(rootProjectId, rootProjectId === projectId ? null : projectId, resourceId, dialogPath);
}

return uri;
};
}
Expand Down Expand Up @@ -285,7 +306,13 @@ export class LuDiagnostic extends DiagnosticInfo {

getUrl = () => {
const { rootProjectId, projectId, resourceId, diagnostic, dialogPath } = this;
let uri = `/bot/${projectId}/language-understanding/${resourceId}/edit#L=${diagnostic.range?.start.line || 0}`;
let uri = generateResourcePageUrl(
rootProjectId,
projectId,
'language-understanding',
resourceId,
diagnostic.range?.start.line
);
if (dialogPath) {
uri = convertPathToUrl(rootProjectId, rootProjectId === projectId ? null : projectId, resourceId, dialogPath);
}
Expand All @@ -302,7 +329,13 @@ export class QnADiagnostic extends DiagnosticInfo {
}

getUrl = () => {
const { rootProjectId, resourceId, diagnostic } = this;
return `/bot/${rootProjectId}/knowledge-base/${resourceId}/edit#L=${diagnostic.range?.start.line || 0}`;
const { rootProjectId, resourceId, projectId, diagnostic } = this;
return generateResourcePageUrl(
rootProjectId,
projectId,
'knowledge-base',
resourceId,
diagnostic.range?.start.line
);
};
}
1 change: 0 additions & 1 deletion Composer/packages/client/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const QnAPage = React.lazy(() => import('./pages/knowledge-base/QnAPage'));
const LGPage = React.lazy(() => import('./pages/language-generation/LGPage'));
const SettingPage = React.lazy(() => import('./pages/setting/SettingsPage'));
const BotProjectSettings = React.lazy(() => import('./pages/botProject/BotProjectSettings'));

const ExtensionsPage = React.lazy(() => import('./pages/extensions/ExtensionsPage'));
const Publish = React.lazy(() => import('./pages/publish/Publish'));
const BotCreationFlowRouter = React.lazy(() => import('./components/CreationFlow/CreationFlow'));
Expand Down
6 changes: 0 additions & 6 deletions Composer/packages/lib/indexers/src/lgIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ const { defaultFileResolver } = TemplatesParser;

function parse(content: string, id = '', importResolver: ImportResolverDelegate = defaultFileResolver) {
const lgFile = Templates.parseText(content, id, importResolver);
lgFile.diagnostics = lgFile.diagnostics.filter(
(diag) => !diag.message.includes('LG file must have at least one template definition.')
);
return convertTemplatesToLgFile(id, content, lgFile);
}

Expand All @@ -25,9 +22,6 @@ function index(files: FileInfo[], importResolver?: ImportResolverDelegate): LgFi
if (name.endsWith('.lg')) {
const id = getBaseName(name, '.lg');
const result = parse(content, id, importResolver);
result.diagnostics = result.diagnostics.filter(
(diag) => !diag.message.includes('LG file must have at least one template definition.')
);
delete result.parseResult;
lgFiles.push(result);
}
Expand Down
3 changes: 3 additions & 0 deletions Composer/packages/lib/indexers/src/utils/lgUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ function getLgResource(lgFile: LgFile, importResolver?: ImportResolverDelegate)
}

export function convertTemplatesToLgFile(id = '', content: string, parseResult: Templates): LgFile {
parseResult.diagnostics = parseResult.diagnostics.filter(
(diag) => !diag.message.includes('LG file must have at least one template definition.')
);
const diagnostics = parseResult.diagnostics.map((d: LGDiagnostic) => {
return convertLGDiagnostic(d, id);
});
Expand Down