Workaround to enable OpenAI documentation on learn.microsoft.com (#31788)
Work item to undo the workaround when proper support is implemented in `type2docfx`: https://github.com/Azure/azure-sdk-for-js/issues/31787 Docs with changes in place: https://review.learn.microsoft.com/en-us/javascript/api/overview/azure/openai-readme?view=azure-node-preview&branch=djurek%2Fopenai-readme The change in `Docs-Toc.ps1` adds the OpenAI entry and then sorts the packages in Cognitive Services so that OpenAI ends up in the right place.
This commit is contained in:
Родитель
a179d22585
Коммит
c2a8656e0f
|
@ -110,6 +110,8 @@ function Get-javascript-RepositoryLink ($packageInfo) {
|
|||
return "$PackageRepositoryUri/$($packageInfo.Package)"
|
||||
}
|
||||
|
||||
# Defined in common.ps1 as:
|
||||
# $UpdateDocsMsTocFn = "Get-${Language}-UpdatedDocsMsToc"
|
||||
function Get-javascript-UpdatedDocsMsToc($toc) {
|
||||
$services = $toc[0].items
|
||||
for ($i = 0; $i -lt $services.Count; $i++) {
|
||||
|
@ -135,6 +137,22 @@ function Get-javascript-UpdatedDocsMsToc($toc) {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
if ($services[$i].name -eq 'Cognitive Services') {
|
||||
# Add OpenAI to the ToC for Cognitive Services
|
||||
$services[$i].items += [PSCustomObject]@{
|
||||
name = "OpenAI";
|
||||
href = "~/docs-ref-services/{moniker}/openai-readme.md";
|
||||
}
|
||||
|
||||
# Sort the items in the Cognitive Services ToC so OpenAI ends up in the
|
||||
# correct place. The "Management" item should always be at the end of the
|
||||
# list.
|
||||
$management = $services[$i].items | Where-Object { $_.name -eq 'Management' }
|
||||
$sortedItems = $services[$i].items | Where-Object { $_.name -ne 'Management' } | Sort-Object -Property name
|
||||
|
||||
$services[$i].items = $sortedItems + $management
|
||||
}
|
||||
}
|
||||
|
||||
# PowerShell outputs a single object if the output is an array with only one
|
||||
|
|
|
@ -27,3 +27,7 @@ extends:
|
|||
Artifacts:
|
||||
- name: azure-openai
|
||||
safeName: azureopenai
|
||||
# Disable publishing to learn.microsoft.com until support is added
|
||||
# to type2docfx tooling for this kind of package layout
|
||||
# https://github.com/Azure/azure-sdk-for-js/issues/31787
|
||||
skipPublishDocMs: true
|
||||
|
|
Загрузка…
Ссылка в новой задаче