mirror of
https://github.com/leon-ai/leon.git
synced 2024-12-01 03:15:58 +03:00
chore: merge
This commit is contained in:
commit
664359158e
32
core/config/voice/schemas.ts
Normal file
32
core/config/voice/schemas.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import type { Static } from '@sinclair/typebox'
|
||||
import { Type } from '@sinclair/typebox'
|
||||
|
||||
const amazonVoiceConfiguration = Type.Object({
|
||||
credentials: Type.Object({
|
||||
accessKeyId: Type.String(),
|
||||
secretAccessKey: Type.String()
|
||||
}),
|
||||
region: Type.String()
|
||||
})
|
||||
const googleCloudVoiceConfiguration = Type.Object({
|
||||
type: Type.Literal('service_account'),
|
||||
project_id: Type.String(),
|
||||
private_key_id: Type.String(),
|
||||
private_key: Type.String(),
|
||||
client_email: Type.String({ format: 'email' }),
|
||||
client_id: Type.String(),
|
||||
auth_uri: Type.String({ format: 'uri' }),
|
||||
token_uri: Type.String({ format: 'uri' }),
|
||||
auth_provider_x509_cert_url: Type.String({ format: 'uri' }),
|
||||
client_x509_cert_url: Type.String({ format: 'uri' })
|
||||
})
|
||||
const watsonVoiceConfiguration = Type.Object({
|
||||
apikey: Type.String(),
|
||||
url: Type.String({ format: 'uri' })
|
||||
})
|
||||
|
||||
export type AmazonVoiceConfiguration = Static<typeof amazonVoiceConfiguration>
|
||||
export type GoogleCloudVoiceConfiguration = Static<
|
||||
typeof googleCloudVoiceConfiguration
|
||||
>
|
||||
export type WatsonVoiceConfiguration = Static<typeof watsonVoiceConfiguration>
|
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>
|
6510
package-lock.json
generated
6510
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
90
skills/schemas.ts
Normal file
90
skills/schemas.ts
Normal file
@ -0,0 +1,90 @@
|
||||
import type { Static } from '@sinclair/typebox'
|
||||
import { Type } from '@sinclair/typebox'
|
||||
|
||||
const domainSchema = {
|
||||
name: Type.String({ minLength: 1 })
|
||||
}
|
||||
const skillBridges = [Type.Literal('python')]
|
||||
const skillSchema = {
|
||||
name: Type.String({ minLength: 1 }),
|
||||
bridge: Type.Union(skillBridges),
|
||||
version: Type.String({ minLength: 1 }),
|
||||
description: Type.String({ minLength: 1 }),
|
||||
author: Type.Object({
|
||||
name: Type.String({ minLength: 1 }),
|
||||
email: Type.String({ minLength: 1, maxLength: 254, format: 'email' }),
|
||||
url: Type.String({ minLength: 1, maxLength: 255, format: 'uri' })
|
||||
})
|
||||
}
|
||||
const skillActionTypes = [Type.Literal('logic'), Type.Literal('dialog')]
|
||||
const skillDataTypes = [
|
||||
Type.Literal('skill_resolver'),
|
||||
Type.Literal('global_resolver'),
|
||||
Type.Literal('entity')
|
||||
]
|
||||
const skillConfigSchema = {
|
||||
variables: Type.Optional(Type.Record(Type.String(), Type.String())),
|
||||
actions: Type.Record(
|
||||
Type.String(),
|
||||
Type.Object({
|
||||
type: Type.Union(skillActionTypes),
|
||||
loop: Type.Optional(
|
||||
Type.Object({
|
||||
expected_item: Type.Object({
|
||||
type: Type.Union(skillDataTypes),
|
||||
name: Type.String()
|
||||
})
|
||||
})
|
||||
),
|
||||
utterance_samples: Type.Optional(Type.Array(Type.String())),
|
||||
answers: Type.Optional(Type.Array(Type.String())),
|
||||
unknown_answers: Type.Optional(Type.Array(Type.String())),
|
||||
suggestions: Type.Optional(Type.Array(Type.String())),
|
||||
slots: Type.Optional(
|
||||
Type.Array(
|
||||
Type.Object({
|
||||
name: Type.String(),
|
||||
item: Type.Object({
|
||||
type: Type.Union(skillDataTypes),
|
||||
name: Type.String()
|
||||
}),
|
||||
questions: Type.Array(Type.String()),
|
||||
suggestions: Type.Optional(Type.Array(Type.String()))
|
||||
})
|
||||
)
|
||||
),
|
||||
entities: Type.Optional(
|
||||
Type.Array(
|
||||
Type.Object({
|
||||
type: Type.Literal('enum'),
|
||||
name: Type.String(),
|
||||
options: Type.Record(
|
||||
Type.String(),
|
||||
Type.Object({
|
||||
synonyms: Type.Array(Type.String())
|
||||
})
|
||||
)
|
||||
})
|
||||
)
|
||||
),
|
||||
next_action: Type.Optional(Type.String())
|
||||
})
|
||||
),
|
||||
answers: Type.Optional(Type.Record(Type.String(), Type.Array(Type.String()))),
|
||||
entities: Type.Optional(Type.Record(Type.String(), Type.String()))
|
||||
}
|
||||
|
||||
const domainSchemaObject = Type.Strict(
|
||||
Type.Object(domainSchema, { additionalProperties: false })
|
||||
)
|
||||
const skillSchemaObject = Type.Strict(
|
||||
Type.Object(skillSchema, { additionalProperties: false })
|
||||
)
|
||||
const skillConfigSchemaObject = Type.Strict(
|
||||
Type.Object(skillConfigSchema, { additionalProperties: false })
|
||||
)
|
||||
|
||||
export type Domain = Static<typeof domainSchemaObject>
|
||||
export type Skill = Static<typeof skillSchemaObject>
|
||||
export type SkillConfig = Static<typeof skillConfigSchemaObject>
|
||||
export type SkillBridge = Static<typeof skillSchema.bridge>
|
Loading…
Reference in New Issue
Block a user