演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
107 lines
2.5 KiB
TypeScript
Generated
107 lines
2.5 KiB
TypeScript
Generated
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import * as z from 'zod'
|
|
|
|
/**
|
|
* GeneratorResponse
|
|
*/
|
|
export const zGeneratorResponse = z.unknown()
|
|
|
|
/**
|
|
* ErrorResponse
|
|
*
|
|
* Documented non-2xx body emitted by ``register_external_error_handlers``.
|
|
*
|
|
* ``params`` and ``details`` appear only on the errors that set them. The schema
|
|
* stays open because ``HTTPException.data`` may carry extra keys.
|
|
*/
|
|
export const zErrorResponse = z.object({
|
|
code: z.string(),
|
|
details: z.record(z.string(), z.unknown()).optional(),
|
|
message: z.string(),
|
|
params: z.string().optional(),
|
|
status: z.int(),
|
|
})
|
|
|
|
/**
|
|
* CompletionRequestError
|
|
*
|
|
* Completion request failed.
|
|
*/
|
|
export const zCompletionRequestError = zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('completion_request_error'),
|
|
status: z.literal(400),
|
|
}),
|
|
)
|
|
|
|
/**
|
|
* ModelCurrentlyNotSupportError
|
|
*
|
|
* Dify Hosted OpenAI trial currently not support the GPT-4 model.
|
|
*/
|
|
export const zModelCurrentlyNotSupportError = zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('model_currently_not_support'),
|
|
status: z.literal(400),
|
|
}),
|
|
)
|
|
|
|
/**
|
|
* ProviderNotInitializeError
|
|
*
|
|
* No valid model provider credentials found. Please go to Settings -> Model Provider to complete your provider credentials.
|
|
*/
|
|
export const zProviderNotInitializeError = zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('provider_not_initialize'),
|
|
status: z.literal(400),
|
|
}),
|
|
)
|
|
|
|
/**
|
|
* ProviderQuotaExceededError
|
|
*
|
|
* Your quota for Dify Hosted Model Provider has been exhausted. Please go to Settings -> Model Provider to complete your own provider credentials.
|
|
*/
|
|
export const zProviderQuotaExceededError = zErrorResponse.and(
|
|
z.object({
|
|
code: z.literal('provider_quota_exceeded'),
|
|
status: z.literal(400),
|
|
}),
|
|
)
|
|
|
|
/**
|
|
* LLMMode
|
|
*
|
|
* Enum class for large language model mode.
|
|
*/
|
|
export const zLlmMode = z.enum(['chat', 'completion'])
|
|
|
|
/**
|
|
* ModelConfig
|
|
*/
|
|
export const zModelConfig = z.object({
|
|
completion_params: z.record(z.string(), z.unknown()).optional(),
|
|
mode: zLlmMode,
|
|
name: z.string(),
|
|
provider: z.string(),
|
|
})
|
|
|
|
/**
|
|
* RuleCodeGeneratePayload
|
|
*/
|
|
export const zRuleCodeGeneratePayload = z.object({
|
|
code_language: z.string().optional().default('javascript'),
|
|
instruction: z.string(),
|
|
model_config: zModelConfig,
|
|
no_variable: z.boolean().optional().default(false),
|
|
})
|
|
|
|
export const zPostRuleCodeGenerateBody = zRuleCodeGeneratePayload
|
|
|
|
/**
|
|
* Code rules generated successfully
|
|
*/
|
|
export const zPostRuleCodeGenerateResponse = zGeneratorResponse
|