mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-10 19:36:04 +08:00
merge
This commit is contained in:
@@ -19,6 +19,8 @@ export interface DecisionFlowDocument extends mongoose.Document {
|
||||
phases: string[]
|
||||
layout?: DecisionFlowLayout
|
||||
metadata?: DecisionFlowMetadata
|
||||
entryMode?: 'parallel' | 'linear'
|
||||
isMain?: boolean
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
@@ -37,6 +39,8 @@ const decisionFlowSchema = new mongoose.Schema<DecisionFlowDocument>(
|
||||
hooks: { type: mongoose.Schema.Types.Mixed, default: () => ({}) },
|
||||
roles: { type: [String], default: () => [] },
|
||||
phases: { type: [String], default: () => [] },
|
||||
entryMode: { type: String, enum: ['parallel', 'linear'], default: 'parallel' },
|
||||
isMain: { type: Boolean, default: false },
|
||||
layout: {
|
||||
type: new mongoose.Schema<DecisionFlowLayout>(
|
||||
{
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import mongoose from 'mongoose'
|
||||
import type {
|
||||
DecisionNodeAutoTrigger,
|
||||
DecisionNodeCondition,
|
||||
DecisionNodeLayout,
|
||||
DecisionNodeLLMPlaceholder,
|
||||
DecisionNodeLLMTemplate,
|
||||
DecisionNodeMetadata,
|
||||
DecisionNodeModel,
|
||||
DecisionNodeTrigger,
|
||||
DecisionNodeTransition,
|
||||
} from '~~/shared/types/decision'
|
||||
|
||||
@@ -88,6 +90,37 @@ const autoTriggerSchema = new mongoose.Schema<DecisionNodeAutoTrigger>(
|
||||
{ _id: false }
|
||||
)
|
||||
|
||||
const triggerSchema = new mongoose.Schema<DecisionNodeTrigger>(
|
||||
{
|
||||
id: { type: String, required: true },
|
||||
type: { type: String, enum: ['auto_time', 'auto_variable', 'regex', 'none'], required: true },
|
||||
order: { type: Number, default: 0 },
|
||||
delaySeconds: { type: Number },
|
||||
variable: { type: String },
|
||||
operator: { type: String },
|
||||
value: { type: mongoose.Schema.Types.Mixed },
|
||||
pattern: { type: String },
|
||||
patternFlags: { type: String },
|
||||
description: { type: String },
|
||||
},
|
||||
{ _id: false }
|
||||
)
|
||||
|
||||
const conditionSchema = new mongoose.Schema<DecisionNodeCondition>(
|
||||
{
|
||||
id: { type: String, required: true },
|
||||
type: { type: String, enum: ['variable_value', 'regex', 'regex_not'], required: true },
|
||||
order: { type: Number, default: 0 },
|
||||
variable: { type: String },
|
||||
operator: { type: String },
|
||||
value: { type: mongoose.Schema.Types.Mixed },
|
||||
pattern: { type: String },
|
||||
patternFlags: { type: String },
|
||||
description: { type: String },
|
||||
},
|
||||
{ _id: false }
|
||||
)
|
||||
|
||||
const transitionSchema = new mongoose.Schema<DecisionNodeTransition>(
|
||||
{
|
||||
key: { type: String, required: true },
|
||||
@@ -158,6 +191,8 @@ const decisionNodeSchema = new mongoose.Schema<DecisionNodeDocument>(
|
||||
trigger: { type: String },
|
||||
frequency: { type: String },
|
||||
frequencyName: { type: String },
|
||||
triggers: { type: [triggerSchema], default: undefined },
|
||||
conditions: { type: [conditionSchema], default: undefined },
|
||||
transitions: { type: [transitionSchema], default: () => [] },
|
||||
layout: { type: layoutSchema, default: undefined },
|
||||
metadata: { type: metadataSchema, default: undefined },
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface TransmissionLogDocument extends mongoose.Document {
|
||||
text: string
|
||||
normalized?: string
|
||||
metadata?: Record<string, any>
|
||||
sessionId?: string
|
||||
createdAt: Date
|
||||
}
|
||||
|
||||
@@ -21,6 +22,7 @@ const transmissionSchema = new mongoose.Schema<TransmissionLogDocument>({
|
||||
text: { type: String, required: true },
|
||||
normalized: { type: String },
|
||||
metadata: { type: Schema.Types.Mixed },
|
||||
sessionId: { type: String, index: true },
|
||||
createdAt: { type: Date, default: () => new Date() },
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user