mirror of
https://github.com/leon-ai/leon.git
synced 2024-11-10 15:19:18 +03:00
feat: add data schemas
This commit is contained in:
parent
29d7f16b2c
commit
6c292994fd
45
core/data/schemas.ts
Normal file
45
core/data/schemas.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import type { Static } from '@sinclair/typebox'
|
||||
import { Type } from '@sinclair/typebox'
|
||||
|
||||
const globalEntity = {
|
||||
options: Type.Record(
|
||||
Type.String(),
|
||||
Type.Object({
|
||||
synonyms: Type.Array(Type.String()),
|
||||
data: Type.Record(Type.String(), Type.Array(Type.String()))
|
||||
})
|
||||
)
|
||||
}
|
||||
const globalResolver = {
|
||||
name: Type.String(),
|
||||
intents: Type.Record(
|
||||
Type.String(),
|
||||
Type.Object({
|
||||
utterance_samples: Type.Array(Type.String()),
|
||||
value: Type.Unknown()
|
||||
})
|
||||
)
|
||||
}
|
||||
const answers = {
|
||||
answers: Type.Record(
|
||||
Type.String(),
|
||||
Type.Union([
|
||||
Type.Record(Type.String(), Type.String()),
|
||||
Type.Array(Type.String())
|
||||
])
|
||||
)
|
||||
}
|
||||
|
||||
const globalEntitySchemaObject = Type.Strict(
|
||||
Type.Object(globalEntity, { additionalProperties: false })
|
||||
)
|
||||
const globalResolverSchemaObject = Type.Strict(
|
||||
Type.Object(globalResolver, { additionalProperties: false })
|
||||
)
|
||||
const answersSchemaObject = Type.Strict(
|
||||
Type.Object(answers, { additionalProperties: false })
|
||||
)
|
||||
|
||||
export type GlobalEntity = Static<typeof globalEntitySchemaObject>
|
||||
export type GlobalResolver = Static<typeof globalResolverSchemaObject>
|
||||
export type Answers = Static<typeof answersSchemaObject>
|
@ -3,7 +3,7 @@ import path from 'node:path'
|
||||
|
||||
import type { ShortLanguageCode } from '@/helpers/lang-helper'
|
||||
import type { Domain } from '@/models/domain'
|
||||
import type { GlobalEntity } from '@/models/global-entities'
|
||||
import type { GlobalEntity } from '@@/core/data/schemas'
|
||||
import type { SkillConfig } from '@/models/skill-config'
|
||||
import type { Skill, SkillBridge } from '@/models/skill'
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
import type { Static } from '@sinclair/typebox'
|
||||
import { Type } from '@sinclair/typebox'
|
||||
|
||||
export const globalEntity = {
|
||||
options: Type.Record(
|
||||
Type.String(),
|
||||
Type.Object({
|
||||
synonyms: Type.Array(Type.String()),
|
||||
data: Type.Record(Type.String(), Type.Array(Type.String()))
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export const globalEntitySchemaObject = Type.Strict(
|
||||
Type.Object(globalEntity, { additionalProperties: false })
|
||||
)
|
||||
|
||||
export type GlobalEntity = Static<typeof globalEntitySchemaObject>
|
@ -1,19 +0,0 @@
|
||||
import type { Static } from '@sinclair/typebox'
|
||||
import { Type } from '@sinclair/typebox'
|
||||
|
||||
export const globalResolver = {
|
||||
name: Type.String(),
|
||||
intents: Type.Record(
|
||||
Type.String(),
|
||||
Type.Object({
|
||||
utterance_samples: Type.Array(Type.String()),
|
||||
value: Type.Unknown()
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export const globalResolverSchemaObject = Type.Strict(
|
||||
Type.Object(globalResolver, { additionalProperties: false })
|
||||
)
|
||||
|
||||
export type GlobalResolver = Static<typeof globalResolverSchemaObject>
|
1
skills/schemas.ts
Normal file
1
skills/schemas.ts
Normal file
@ -0,0 +1 @@
|
||||
// TODO
|
Loading…
Reference in New Issue
Block a user