Skip to content

Commit 9501752

Browse files
committed
add save train
1 parent 781f76b commit 9501752

File tree

17 files changed

+2288
-5032
lines changed

17 files changed

+2288
-5032
lines changed

server/model.nlp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"settings":{"languages":["en"],"forceNER":true,"tag":"nlp","threshold":0.5,"autoLoad":true,"autoSave":true,"modelFileName":"model.nlp","executeActionsBeforeAnswers":false,"calculateSentiment":true},"nluManager":{"settings":{"tag":"nlu-manager"},"locales":["en"],"languageNames":{},"domainManagers":{"en":{"settings":{"locale":"en","trainByDomain":false,"tag":"domain-manager-en","nluByDomain":{"default":{"className":"NeuralNlu","settings":{}}},"useStemDict":true},"stemDict":{"meet,nice,to,you":{"intent":"greeting","domain":"default"},"hello":{"intent":"greeting","domain":"default"},"hi":{"intent":"greeting","domain":"default"},"are,how,you":{"intent":"greeting","domain":"default"},"again,see,you":{"intent":"goodbye","domain":"default"},"see,ya":{"intent":"goodbye","domain":"default"},"later,see,you":{"intent":"goodbye","domain":"default"},"bye":{"intent":"goodbye","domain":"default"},"goodby":{"intent":"goodbye","domain":"default"}},"intentDict":{"greeting":"default","goodbye":"default"},"sentences":[{"domain":"default","utterance":"nice to meet you","intent":"greeting"},{"domain":"default","utterance":"hello","intent":"greeting"},{"domain":"default","utterance":"hi","intent":"greeting"},{"domain":"default","utterance":"how are you","intent":"greeting"},{"domain":"default","utterance":"see you again","intent":"goodbye"},{"domain":"default","utterance":"see ya","intent":"goodbye"},{"domain":"default","utterance":"see you later","intent":"goodbye"},{"domain":"default","utterance":"bye","intent":"goodbye"},{"domain":"default","utterance":"goodbye","intent":"goodbye"}],"domains":{"master_domain":{"settings":{"locale":"en","tag":"nlu-en","keepStopwords":true,"nonefeatureValue":1,"nonedeltaMultiplier":1.2,"spellCheck":false,"spellCheckDistance":1,"filterZeros":true,"log":true},"features":{"nice":1,"to":1,"meet":1,"you":1,"hello":1,"hi":1,"how":1,"are":1,"see":1,"again":1,"ya":1,"later":1,"bye":1,"goodby":1},"intents":{"greeting":1,"goodbye":1},"intentFeatures":{"greeting":{"nice":1,"to":1,"meet":1,"you":1,"hello":1,"hi":1,"how":1,"are":1},"goodbye":{"see":1,"you":1,"again":1,"ya":1,"later":1,"bye":1,"goodby":1}},"featuresToIntent":{"nice":["greeting"],"to":["greeting"],"meet":["greeting"],"you":["greeting","goodbye"],"hello":["greeting"],"hi":["greeting"],"how":["greeting"],"are":["greeting"],"see":["goodbye"],"again":["goodbye"],"ya":["goodbye"],"later":["goodbye"],"bye":["goodbye"],"goodby":["goodbye"]},"neuralNetwork":{"settings":{"locale":"en","tag":"nlu-en","keepStopwords":true,"nonefeatureValue":1,"nonedeltaMultiplier":1.2,"spellCheck":false,"spellCheckDistance":1,"filterZeros":true,"log":true},"features":["nice","to","meet","you","hello","hi","how","are","see","again","ya","later","bye","goodby"],"intents":["greeting","goodbye"],"perceptrons":[[2.462721109390259,2.462721109390259,2.462721109390259,1.9370678663253784,9.200018882751465,9.17052173614502,3.6849207878112793,3.6849207878112793,-4.902862071990967,-2.1647493839263916,-0.6346772313117981,-2.0334362983703613,-4.855294227600098,-4.832851409912109,4.963890790483976],[-1.7783807516098022,-1.7783807516098022,-1.7783807516098022,0.050939083099365234,-5.033719539642334,-5.010004997253418,-2.5959596633911133,-2.5959596633911133,6.828719139099121,2.2451364994049072,2.326434373855591,2.2576451301574707,9.009735107421875,8.979744911193848,5.160933679306533]]}}}}},"intentDomains":{},"extraSentences":[["en","nice to meet you"],["en","hello"],["en","hi"],["en","how are you"],["en","see you again"],["en","see ya"],["en","see you later"],["en","bye"],["en","goodbye"]]},"ner":{"settings":{"tag":"ner","entityPreffix":"%","entitySuffix":"%"},"rules":{}},"nlgManager":{"settings":{"tag":"nlg-manager"},"responses":{}},"actionManager":{"settings":{"tag":"action-manager"},"actions":{}},"slotManager":{}}

server/package-lock.json

Lines changed: 1341 additions & 5008 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/src/constants/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export const ENDPOINTS = {
5656
ADD_CHANNELS: '/flow/add-channels',
5757
SELECT_FLOWS_FOR_CHANNEL: '/flow/select',
5858
},
59+
INTENT: {
60+
INDEX: '/intent',
61+
}
5962
}
6063

6164
export const LOCALE_KEY = 'lang'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { LOCALE_KEY } from "@/constants"
2+
import { LocaleService } from "@/i18n/ctx"
3+
import { RequestWithUser } from "@/interfaces/auth.interface"
4+
import { IntentService } from "@/services/intent.service"
5+
import { catchAsync } from "@/utils/catch-async"
6+
import { StatusCodes } from "http-status-codes"
7+
import Container from "typedi"
8+
9+
export class IntentController {
10+
public intentService = Container.get(IntentService)
11+
public localeService = Container.get<LocaleService>(LOCALE_KEY)
12+
13+
public createIntent = catchAsync(async (req: RequestWithUser, res) => {
14+
req.body.userId = req.user?.id
15+
const data = await this.intentService.create(req.body)
16+
res.status(StatusCodes.OK).json({
17+
message: this.localeService.i18n().INTENT.CREATE_SUCCESS(),
18+
data,
19+
})
20+
})
21+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
CREATE TABLE IF NOT EXISTS "intents" (
2+
"id" varchar(36) PRIMARY KEY NOT NULL,
3+
"name" text NOT NULL,
4+
"reference_id" text NOT NULL,
5+
"intents" json DEFAULT '[]'::json,
6+
"entities" json DEFAULT '[]'::json NOT NULL,
7+
"user_id" varchar(36) NOT NULL,
8+
"deleted" boolean DEFAULT false,
9+
"created_at" timestamp DEFAULT now(),
10+
"updated_at" timestamp DEFAULT now()
11+
);
12+
--> statement-breakpoint
13+
ALTER TABLE "flows" DROP CONSTRAINT "flows_user_id_users_id_fk";
14+
--> statement-breakpoint
15+
DO $$ BEGIN
16+
ALTER TABLE "flows" ADD CONSTRAINT "flows_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action;
17+
EXCEPTION
18+
WHEN duplicate_object THEN null;
19+
END $$;
20+
--> statement-breakpoint
21+
DO $$ BEGIN
22+
ALTER TABLE "intents" ADD CONSTRAINT "intents_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE cascade ON UPDATE no action;
23+
EXCEPTION
24+
WHEN duplicate_object THEN null;
25+
END $$;

0 commit comments

Comments
 (0)