kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/715/head
rodzic
8cb6dca4ee
commit
148f36d37e
|
@ -30,8 +30,10 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) {
|
||||||
headers: expectedHeaders,
|
headers: expectedHeaders,
|
||||||
body: expectedBody
|
body: expectedBody
|
||||||
} = fixture.response ?? {}
|
} = fixture.response ?? {}
|
||||||
const { snapshot = status >= 200 && status < 300 } =
|
const snapshot =
|
||||||
fixture.response ?? {}
|
fixture.response?.snapshot ??
|
||||||
|
fixtureSuite.snapshot ??
|
||||||
|
(status >= 200 && status < 300)
|
||||||
const debugFixture = !!(fixture.debug ?? fixtureSuite.debug)
|
const debugFixture = !!(fixture.debug ?? fixtureSuite.debug)
|
||||||
|
|
||||||
let testFn = fixture.only ? test.only : test
|
let testFn = fixture.only ? test.only : test
|
||||||
|
|
|
@ -47,6 +47,9 @@ export type E2ETestFixtureSuite = {
|
||||||
|
|
||||||
/** @default false */
|
/** @default false */
|
||||||
debug?: boolean
|
debug?: boolean
|
||||||
|
|
||||||
|
/** @default undefined */
|
||||||
|
snapshot?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = Date.now()
|
const now = Date.now()
|
||||||
|
@ -354,7 +357,6 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
|
||||||
{
|
{
|
||||||
title: 'Basic MCP origin "add" tool call success',
|
title: 'Basic MCP origin "add" tool call success',
|
||||||
compareResponseBodies: true,
|
compareResponseBodies: true,
|
||||||
// debug: true,
|
|
||||||
fixtures: [
|
fixtures: [
|
||||||
{
|
{
|
||||||
path: '@dev/test-basic-mcp/add',
|
path: '@dev/test-basic-mcp/add',
|
||||||
|
@ -385,8 +387,7 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Basic MCP origin "echo" tool call success',
|
title: 'Basic MCP origin "echo" tool call success',
|
||||||
only: true,
|
snapshot: false,
|
||||||
debug: true,
|
|
||||||
fixtures: [
|
fixtures: [
|
||||||
{
|
{
|
||||||
path: '@dev/test-basic-mcp/echo',
|
path: '@dev/test-basic-mcp/echo',
|
||||||
|
@ -394,12 +395,38 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
json: {
|
json: {
|
||||||
nala: 'kitten',
|
nala: 'kitten',
|
||||||
|
num: 123,
|
||||||
now
|
now
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
response: {
|
response: {
|
||||||
body: [
|
body: [
|
||||||
{ type: 'text', text: JSON.stringify({ nala: 'kitten', now }) }
|
{
|
||||||
|
type: 'text',
|
||||||
|
text: JSON.stringify({ nala: 'kitten', num: 123, now })
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '@dev/test-basic-mcp/echo',
|
||||||
|
request: {
|
||||||
|
searchParams: {
|
||||||
|
nala: 'kitten',
|
||||||
|
num: 123,
|
||||||
|
now
|
||||||
|
}
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
body: [
|
||||||
|
{
|
||||||
|
type: 'text',
|
||||||
|
text: JSON.stringify({
|
||||||
|
nala: 'kitten',
|
||||||
|
num: '123',
|
||||||
|
now: `${now}`
|
||||||
|
})
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ export function updateOriginRequest(
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Delete all Cloudflare headers since we want origin requests to be agnostic
|
// Delete all Cloudflare headers since we want origin requests to be agnostic
|
||||||
// to Agentic's choice of API gateway hosting provider.
|
// to Agentic's choice of hosting provider.
|
||||||
for (const headerKey of Object.keys(
|
for (const headerKey of Object.keys(
|
||||||
Object.fromEntries(originRequest.headers.entries())
|
Object.fromEntries(originRequest.headers.entries())
|
||||||
)) {
|
)) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ server.addTool({
|
||||||
|
|
||||||
server.addTool({
|
server.addTool({
|
||||||
name: 'echo',
|
name: 'echo',
|
||||||
description: 'Echos back the input parameters.',
|
description: 'Echoes back the input parameters.',
|
||||||
parameters: z.record(z.string(), z.any()),
|
parameters: z.record(z.string(), z.any()),
|
||||||
execute: async (args) => {
|
execute: async (args) => {
|
||||||
return JSON.stringify(args)
|
return JSON.stringify(args)
|
||||||
|
|
Ładowanie…
Reference in New Issue