mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: refine nlp pattern type check
This commit is contained in:
parent
89c46e9948
commit
a8666ceb57
@ -65,15 +65,13 @@ export type NlpPatternMatchResult = {
|
||||
matchedPattern: NlpPattern[];
|
||||
};
|
||||
|
||||
export function isNlpPattern(
|
||||
pattern: unknown,
|
||||
): pattern is { entity: string; match: 'entity' | 'value' } {
|
||||
export function isNlpPattern(pattern: NlpPattern) {
|
||||
return (
|
||||
(typeof pattern === 'object' &&
|
||||
pattern !== null &&
|
||||
'entity' in pattern &&
|
||||
'match' in pattern &&
|
||||
(pattern as any).match === 'entity') ||
|
||||
(pattern as any).match === 'value'
|
||||
pattern.match === 'entity') ||
|
||||
pattern.match === 'value'
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user