kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/700/head
rodzic
3b32894992
commit
47dabc296e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue