chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
60158935f4
commit
6519682885
15831 files changed
+3063428
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import type { LLMEnvironmentVariableValue } from '@/app/components/workflow/types'
|
||||
|
||||
const VALID_LLM_ENVIRONMENT_VARIABLE_MODES = new Set(['chat', 'completion'])
|
||||
|
||||
export function isLLMEnvironmentVariableValue(
|
||||
value: unknown,
|
||||
): value is LLMEnvironmentVariableValue {
|
||||
if (typeof value !== 'object' || value === null) return false
|
||||
|
||||
const candidate = value as Partial<LLMEnvironmentVariableValue>
|
||||
return (
|
||||
typeof candidate.provider === 'string' &&
|
||||
candidate.provider.trim().length > 0 &&
|
||||
typeof candidate.name === 'string' &&
|
||||
candidate.name.trim().length > 0 &&
|
||||
typeof candidate.mode === 'string' &&
|
||||
VALID_LLM_ENVIRONMENT_VARIABLE_MODES.has(candidate.mode) &&
|
||||
(candidate.completion_params === undefined ||
|
||||
(typeof candidate.completion_params === 'object' &&
|
||||
candidate.completion_params !== null &&
|
||||
!Array.isArray(candidate.completion_params)))
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user