kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: bump deps; fix eslint
rodzic
8ea89eae91
commit
9296e75dd4
|
@ -1 +0,0 @@
|
||||||
out
|
|
|
@ -1,9 +1,5 @@
|
||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"extends": ["@fisch0920/eslint-config/node"],
|
"extends": ["@fisch0920/eslint-config/node"],
|
||||||
"rules": {
|
"ignorePatterns": ["out"]
|
||||||
"unicorn/no-static-only-class": "off",
|
|
||||||
"unicorn/no-array-reduce": "off",
|
|
||||||
"@typescript-eslint/naming-convention": "off"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
10
package.json
10
package.json
|
@ -35,19 +35,19 @@
|
||||||
"@changesets/cli": "^2.27.7",
|
"@changesets/cli": "^2.27.7",
|
||||||
"@fisch0920/eslint-config": "^1.4.0",
|
"@fisch0920/eslint-config": "^1.4.0",
|
||||||
"@total-typescript/ts-reset": "^0.5.1",
|
"@total-typescript/ts-reset": "^0.5.1",
|
||||||
"@types/node": "^22.1.0",
|
"@types/node": "^22.4.0",
|
||||||
"del-cli": "^5.1.0",
|
"del-cli": "^5.1.0",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"husky": "^9.1.4",
|
"husky": "^9.1.4",
|
||||||
"lint-staged": "^15.2.8",
|
"lint-staged": "^15.2.9",
|
||||||
"mintlify": "^4.0.195",
|
"mintlify": "^4.0.203",
|
||||||
"npm-run-all2": "^6.2.2",
|
"npm-run-all2": "^6.2.2",
|
||||||
"only-allow": "^1.2.1",
|
"only-allow": "^1.2.1",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"tsup": "^8.2.4",
|
"tsup": "^8.2.4",
|
||||||
"tsx": "^4.16.5",
|
"tsx": "^4.17.0",
|
||||||
"turbo": "^2.0.12",
|
"turbo": "^2.0.14",
|
||||||
"typescript": "^5.5.4",
|
"typescript": "^5.5.4",
|
||||||
"vitest": "2.0.5",
|
"vitest": "2.0.5",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
|
|
|
@ -31,8 +31,8 @@ export type AIChainParams<Result extends types.AIChainResult = string> = {
|
||||||
schema?: z.ZodType<Result> | types.Schema<Result>
|
schema?: z.ZodType<Result> | types.Schema<Result>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the response schema should be treated as strict for
|
* Whether or not the response schema should use OpenAI's structured output
|
||||||
* constrained structured output generation.
|
* generation.
|
||||||
*/
|
*/
|
||||||
strict?: boolean
|
strict?: boolean
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ export namespace Msg {
|
||||||
|
|
||||||
/** Create a function call message with argumets. */
|
/** Create a function call message with argumets. */
|
||||||
export function funcCall(
|
export function funcCall(
|
||||||
function_call: {
|
funcCall: {
|
||||||
/** Name of the function to call. */
|
/** Name of the function to call. */
|
||||||
name: string
|
name: string
|
||||||
/** Arguments to pass to the function. */
|
/** Arguments to pass to the function. */
|
||||||
|
@ -246,7 +246,7 @@ export namespace Msg {
|
||||||
...opts,
|
...opts,
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content: null,
|
content: null,
|
||||||
function_call
|
function_call: funcCall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ export namespace Msg {
|
||||||
|
|
||||||
/** Create a function call message with argumets. */
|
/** Create a function call message with argumets. */
|
||||||
export function toolCall(
|
export function toolCall(
|
||||||
tool_calls: Msg.Call.Tool[],
|
toolCalls: Msg.Call.Tool[],
|
||||||
opts?: {
|
opts?: {
|
||||||
/** The name descriptor for the message.(message.name) */
|
/** The name descriptor for the message.(message.name) */
|
||||||
name?: string
|
name?: string
|
||||||
|
@ -271,21 +271,26 @@ export namespace Msg {
|
||||||
...opts,
|
...opts,
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content: null,
|
content: null,
|
||||||
tool_calls
|
tool_calls: toolCalls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a tool call result message. */
|
/** Create a tool call result message. */
|
||||||
export function toolResult(
|
export function toolResult(
|
||||||
content: Jsonifiable,
|
content: Jsonifiable,
|
||||||
tool_call_id: string,
|
toolCallId: string,
|
||||||
opts?: {
|
opts?: {
|
||||||
/** The name of the tool which was called */
|
/** The name of the tool which was called */
|
||||||
name?: string
|
name?: string
|
||||||
}
|
}
|
||||||
): Msg.ToolResult {
|
): Msg.ToolResult {
|
||||||
const contentString = stringifyForModel(content)
|
const contentString = stringifyForModel(content)
|
||||||
return { ...opts, role: 'tool', tool_call_id, content: contentString }
|
return {
|
||||||
|
...opts,
|
||||||
|
role: 'tool',
|
||||||
|
tool_call_id: toolCallId,
|
||||||
|
content: contentString
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the narrowed message from an EnrichedResponse. */
|
/** Get the narrowed message from an EnrichedResponse. */
|
||||||
|
@ -327,7 +332,7 @@ export namespace Msg {
|
||||||
}
|
}
|
||||||
/** Check if a message is an assistant message. */
|
/** Check if a message is an assistant message. */
|
||||||
export function isAssistant(message: Msg): message is Msg.Assistant {
|
export function isAssistant(message: Msg): message is Msg.Assistant {
|
||||||
return message.role === 'assistant' && message.content !== null
|
return message.role === 'assistant' && message.content != null
|
||||||
}
|
}
|
||||||
/** Check if a message is an assistant refusal message. */
|
/** Check if a message is an assistant refusal message. */
|
||||||
export function isRefusal(message: Msg): message is Msg.Refusal {
|
export function isRefusal(message: Msg): message is Msg.Refusal {
|
||||||
|
|
|
@ -217,13 +217,10 @@ export function sanitizeSearchParams(
|
||||||
return new URLSearchParams(entries)
|
return new URLSearchParams(entries)
|
||||||
}
|
}
|
||||||
|
|
||||||
const csvEntries = entries.reduce(
|
const csvEntries: Record<string, string> = {}
|
||||||
(acc, [key, value]) => ({
|
for (const [key, value] of entries) {
|
||||||
...acc,
|
csvEntries[key] = csvEntries[key] ? `${csvEntries[key]},${value}` : value
|
||||||
[key]: acc[key] ? `${acc[key]},${value}` : value
|
}
|
||||||
}),
|
|
||||||
{} as any
|
|
||||||
)
|
|
||||||
|
|
||||||
return new URLSearchParams(csvEntries)
|
return new URLSearchParams(csvEntries)
|
||||||
}
|
}
|
||||||
|
|
2136
pnpm-lock.yaml
2136
pnpm-lock.yaml
Plik diff jest za duży
Load Diff
Ładowanie…
Reference in New Issue