kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
fbb9863208
commit
ab32e0bb6a
|
@ -46,6 +46,5 @@ out/
|
|||
apps/api/auth-db-temp.json
|
||||
|
||||
.dev.vars
|
||||
.dev.vars.*
|
||||
|
||||
.wrangler
|
|
@ -0,0 +1,5 @@
|
|||
ENVIRONMENT=
|
||||
SENTRY_DSN=
|
||||
|
||||
AGENTIC_API_BASE_URL=
|
||||
AGENTIC_API_KEY=
|
|
@ -78,7 +78,7 @@ app.all(async (ctx) => {
|
|||
|
||||
case 'mcp': {
|
||||
assert(
|
||||
resolvedOriginRequest.toolArgs,
|
||||
resolvedOriginRequest.toolCallArgs,
|
||||
500,
|
||||
'Tool args are required for MCP origin requests'
|
||||
)
|
||||
|
@ -99,7 +99,7 @@ app.all(async (ctx) => {
|
|||
// TODO: add response caching for MCP tool calls
|
||||
const toolCallResponse = await client.callTool({
|
||||
name: resolvedOriginRequest.tool.name,
|
||||
arguments: resolvedOriginRequest.toolArgs
|
||||
arguments: resolvedOriginRequest.toolCallArgs
|
||||
})
|
||||
|
||||
originResponse = await createHttpResponseFromMcpToolCallResponse(ctx, {
|
||||
|
|
|
@ -4,7 +4,7 @@ import type {
|
|||
} from '@agentic/platform-types'
|
||||
import { assert } from '@agentic/platform-core'
|
||||
|
||||
import type { GatewayHonoContext, ToolArgs } from './types'
|
||||
import type { GatewayHonoContext, ToolCallArgs } from './types'
|
||||
|
||||
export async function createRequestForOpenAPIOperation(
|
||||
ctx: GatewayHonoContext,
|
||||
|
@ -13,7 +13,7 @@ export async function createRequestForOpenAPIOperation(
|
|||
operation,
|
||||
deployment
|
||||
}: {
|
||||
toolArgs: ToolArgs
|
||||
toolArgs: ToolCallArgs
|
||||
operation: OpenAPIToolOperation
|
||||
deployment: AdminDeployment
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import type {
|
|||
AdminConsumer,
|
||||
GatewayHonoContext,
|
||||
ResolvedOriginRequest,
|
||||
ToolArgs
|
||||
ToolCallArgs
|
||||
} from './types'
|
||||
import { createRequestForOpenAPIOperation } from './create-request-for-openapi-operation'
|
||||
import { enforceRateLimit } from './enforce-rate-limit'
|
||||
|
@ -168,7 +168,7 @@ export async function resolveOriginRequest(
|
|||
if (rateLimit) {
|
||||
await enforceRateLimit(ctx, {
|
||||
id: consumer?.id ?? ip,
|
||||
interval: rateLimit.interval * 1000,
|
||||
interval: rateLimit.interval,
|
||||
maxPerInterval: rateLimit.maxPerInterval,
|
||||
method,
|
||||
pathname
|
||||
|
@ -177,7 +177,7 @@ export async function resolveOriginRequest(
|
|||
|
||||
const { originAdapter } = deployment
|
||||
let originRequest: Request | undefined
|
||||
let toolArgs: ToolArgs | undefined
|
||||
let toolArgs: ToolCallArgs | undefined
|
||||
|
||||
if (originAdapter.type === 'raw') {
|
||||
const originRequestUrl = `${deployment.originUrl}/${toolName}${requestUrl.search}`
|
||||
|
@ -207,7 +207,7 @@ export async function resolveOriginRequest(
|
|||
|
||||
return {
|
||||
originRequest,
|
||||
toolArgs,
|
||||
toolCallArgs: toolArgs,
|
||||
deployment,
|
||||
consumer,
|
||||
tool,
|
||||
|
|
|
@ -42,7 +42,7 @@ export type GatewayHonoEnv = {
|
|||
export type GatewayHonoContext = Context<GatewayHonoEnv>
|
||||
|
||||
// TODO: better type here
|
||||
export type ToolArgs = Record<string, any>
|
||||
export type ToolCallArgs = Record<string, any>
|
||||
|
||||
export type ResolvedOriginRequest = {
|
||||
deployment: AdminDeployment
|
||||
|
@ -55,5 +55,5 @@ export type ResolvedOriginRequest = {
|
|||
pricingPlanSlug?: string
|
||||
|
||||
originRequest?: Request
|
||||
toolArgs?: ToolArgs
|
||||
toolCallArgs?: ToolCallArgs
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
- auth
|
||||
- custom auth pages for `openauth`
|
||||
- API gateway
|
||||
- enforce rate limits
|
||||
- how to handle binary bodies and responses?
|
||||
- add support for `immutable` in `toolConfigs`
|
||||
- **Public MCP server interface**
|
||||
|
|
Ładowanie…
Reference in New Issue