pull/700/head
Travis Fischer 2025-03-23 04:30:50 +08:00
rodzic 3b32894992
commit 47dabc296e
3 zmienionych plików z 16 dodań i 6 usunięć

Wyświetl plik

@ -1468,7 +1468,7 @@ export namespace notion {
/**
* Agentic Notion client.
*
* API specification for Notion
* API specification for Notion.
*/
export class NotionClient extends AIFunctionsProvider {
protected readonly ky: KyInstance

Wyświetl plik

@ -16,6 +16,7 @@ import {
getAndResolve,
getComponentDisplayName,
getComponentName,
getDescription,
getOperationParamsName,
getOperationResponseName,
jsonSchemaToZod,
@ -472,10 +473,9 @@ async function main() {
? '`' + path.replaceAll(/{([^}]+)}/g, '${params["$1"]}') + '`'
: `'${path}'`
let description = operation.description || operation.summary
if (description && !/[!.?]$/.test(description)) {
description += '.'
}
const description = getDescription(
operation.description || operation.summary
)
const isDescriptionMultiline = description?.includes('\n')
const aiClientMethod = `
@ -604,6 +604,8 @@ import { z } from 'zod'`.trim()
.filter(Boolean)
.join('\n\n')
const description = getDescription(spec.info?.description)
const output = (
await prettify(
[
@ -611,7 +613,7 @@ import { z } from 'zod'`.trim()
`
/**
* Agentic ${name} client.${spec.info?.description ? `\n *\n * ${spec.info.description}` : ''}
* Agentic ${name} client.${description ? `\n *\n * ${description}` : ''}
*/
export class ${clientName} extends AIFunctionsProvider {
protected readonly ky: KyInstance

Wyświetl plik

@ -322,3 +322,11 @@ export function naiveMergeJSONSchemas(...schemas: IJsonSchema[]): IJsonSchema {
return result as IJsonSchema
}
export function getDescription(description?: string): string | undefined {
if (description && !/[!.?]$/.test(description)) {
description += '.'
}
return description
}