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,
|
||||
"extends": ["@fisch0920/eslint-config/node"],
|
||||
"rules": {
|
||||
"unicorn/no-static-only-class": "off",
|
||||
"unicorn/no-array-reduce": "off",
|
||||
"@typescript-eslint/naming-convention": "off"
|
||||
}
|
||||
"ignorePatterns": ["out"]
|
||||
}
|
||||
|
|
10
package.json
10
package.json
|
@ -35,19 +35,19 @@
|
|||
"@changesets/cli": "^2.27.7",
|
||||
"@fisch0920/eslint-config": "^1.4.0",
|
||||
"@total-typescript/ts-reset": "^0.5.1",
|
||||
"@types/node": "^22.1.0",
|
||||
"@types/node": "^22.4.0",
|
||||
"del-cli": "^5.1.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"eslint": "^8.57.0",
|
||||
"husky": "^9.1.4",
|
||||
"lint-staged": "^15.2.8",
|
||||
"mintlify": "^4.0.195",
|
||||
"lint-staged": "^15.2.9",
|
||||
"mintlify": "^4.0.203",
|
||||
"npm-run-all2": "^6.2.2",
|
||||
"only-allow": "^1.2.1",
|
||||
"prettier": "^3.3.3",
|
||||
"tsup": "^8.2.4",
|
||||
"tsx": "^4.16.5",
|
||||
"turbo": "^2.0.12",
|
||||
"tsx": "^4.17.0",
|
||||
"turbo": "^2.0.14",
|
||||
"typescript": "^5.5.4",
|
||||
"vitest": "2.0.5",
|
||||
"zod": "^3.23.8"
|
||||
|
|
|
@ -31,8 +31,8 @@ export type AIChainParams<Result extends types.AIChainResult = string> = {
|
|||
schema?: z.ZodType<Result> | types.Schema<Result>
|
||||
|
||||
/**
|
||||
* Whether or not the response schema should be treated as strict for
|
||||
* constrained structured output generation.
|
||||
* Whether or not the response schema should use OpenAI's structured output
|
||||
* generation.
|
||||
*/
|
||||
strict?: boolean
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ export namespace Msg {
|
|||
|
||||
/** Create a function call message with argumets. */
|
||||
export function funcCall(
|
||||
function_call: {
|
||||
funcCall: {
|
||||
/** Name of the function to call. */
|
||||
name: string
|
||||
/** Arguments to pass to the function. */
|
||||
|
@ -246,7 +246,7 @@ export namespace Msg {
|
|||
...opts,
|
||||
role: 'assistant',
|
||||
content: null,
|
||||
function_call
|
||||
function_call: funcCall
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ export namespace Msg {
|
|||
|
||||
/** Create a function call message with argumets. */
|
||||
export function toolCall(
|
||||
tool_calls: Msg.Call.Tool[],
|
||||
toolCalls: Msg.Call.Tool[],
|
||||
opts?: {
|
||||
/** The name descriptor for the message.(message.name) */
|
||||
name?: string
|
||||
|
@ -271,21 +271,26 @@ export namespace Msg {
|
|||
...opts,
|
||||
role: 'assistant',
|
||||
content: null,
|
||||
tool_calls
|
||||
tool_calls: toolCalls
|
||||
}
|
||||
}
|
||||
|
||||
/** Create a tool call result message. */
|
||||
export function toolResult(
|
||||
content: Jsonifiable,
|
||||
tool_call_id: string,
|
||||
toolCallId: string,
|
||||
opts?: {
|
||||
/** The name of the tool which was called */
|
||||
name?: string
|
||||
}
|
||||
): Msg.ToolResult {
|
||||
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. */
|
||||
|
@ -327,7 +332,7 @@ export namespace Msg {
|
|||
}
|
||||
/** Check if a message is an assistant message. */
|
||||
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. */
|
||||
export function isRefusal(message: Msg): message is Msg.Refusal {
|
||||
|
|
|
@ -217,13 +217,10 @@ export function sanitizeSearchParams(
|
|||
return new URLSearchParams(entries)
|
||||
}
|
||||
|
||||
const csvEntries = entries.reduce(
|
||||
(acc, [key, value]) => ({
|
||||
...acc,
|
||||
[key]: acc[key] ? `${acc[key]},${value}` : value
|
||||
}),
|
||||
{} as any
|
||||
)
|
||||
const csvEntries: Record<string, string> = {}
|
||||
for (const [key, value] of entries) {
|
||||
csvEntries[key] = csvEntries[key] ? `${csvEntries[key]},${value}` : value
|
||||
}
|
||||
|
||||
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