Merge branch 'langgenius:main' into fix-doc-TOC-style

pull/18314/head
GuanMu 12 months ago committed by GitHub
commit 349e53a0c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -36,7 +36,7 @@ class SQLAlchemyWorkflowNodeExecutionRepository:
"""
# If an engine is provided, create a sessionmaker from it
if isinstance(session_factory, Engine):
self._session_factory = sessionmaker(bind=session_factory)
self._session_factory = sessionmaker(bind=session_factory, expire_on_commit=False)
else:
self._session_factory = session_factory

@ -132,12 +132,13 @@ async function base<T>(url: string, options: FetchOptionType = {}, otherOptions:
getAbortController,
} = otherOptions
const base
= isMarketplaceAPI
? MARKETPLACE_API_PREFIX
: isPublicAPI
? PUBLIC_API_PREFIX
: API_PREFIX
let base: string
if (isMarketplaceAPI)
base = MARKETPLACE_API_PREFIX
else if (isPublicAPI)
base = PUBLIC_API_PREFIX
else
base = API_PREFIX
if (getAbortController) {
const abortController = new AbortController()
@ -145,7 +146,7 @@ async function base<T>(url: string, options: FetchOptionType = {}, otherOptions:
options.signal = abortController.signal
}
const fetchPathname = `${base}${url.startsWith('/') ? url : `/${url}`}`
const fetchPathname = base + (url.startsWith('/') ? url : `/${url}`)
if (deleteContentType)
(headers as any).delete('Content-Type')
@ -180,6 +181,16 @@ async function base<T>(url: string, options: FetchOptionType = {}, otherOptions:
},
...(bodyStringify ? { json: body } : { body: body as BodyInit }),
searchParams: params,
fetch(resource: RequestInfo | URL, options?: RequestInit) {
if (resource instanceof Request && options) {
const mergedHeaders = new Headers(options.headers || {})
resource.headers.forEach((value, key) => {
mergedHeaders.append(key, value)
})
options.headers = mergedHeaders
}
return globalThis.fetch(resource, options)
},
})
if (needAllResponseContent)

Loading…
Cancel
Save