Compare commits
10 Commits
9b94a0b334
...
cc0b442f3d
| Author | SHA1 | Date | |
|---|---|---|---|
| cc0b442f3d | |||
| 6e1aadb2a7 | |||
| 1532326719 | |||
| 2aa81df961 | |||
| 266bdd6a55 | |||
| f338f7b4d7 | |||
| f58bfc1477 | |||
| 2335a43e46 | |||
| 81a83d201d | |||
| 45b7becfe5 |
@ -1,4 +1,4 @@
|
||||
name: Build and Push Docker Image
|
||||
name: Build and Push NLP Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -9,7 +9,19 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Checkout repository with submodules
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
|
||||
- name: Initialize submodules
|
||||
run: |
|
||||
git submodule sync --recursive
|
||||
git submodule update --init --recursive
|
||||
git submodule status
|
||||
ls -la src/modules/db
|
||||
ls -la src/modules/redis
|
||||
|
||||
- name: Login to Registry
|
||||
uses: docker/login-action@v3
|
||||
@ -25,7 +37,7 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and Push (multi-arch)
|
||||
- name: Build and Push NLP (multi-arch)
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
@ -34,9 +46,9 @@ jobs:
|
||||
build-args: |
|
||||
BUILD_IDENTIFIER=${{ steps.vars.outputs.short_sha }}
|
||||
tags: |
|
||||
gitea.spilum.net/spilum.net/mtf-nlp:${{ github.ref_name }}-${{ steps.vars.outputs.short_sha }}
|
||||
gitea.spilum.net/spilum.net/mtf-nlp:${{ github.ref_name }}-latest
|
||||
gitea.spilum.net/spilum.net/mtf-nlp:${{ steps.vars.outputs.short_sha }}
|
||||
gitea.spilum.net/spilum.net/mtf-nlp:latest
|
||||
|
||||
- name: Log out from registry
|
||||
if: always()
|
||||
run: docker logout gitea.spilum.net
|
||||
run: docker logout gitea.spilum.net
|
||||
@ -1 +1 @@
|
||||
Subproject commit 484c5bd8e5a5c77ef2c6a20817205de99cbc77ce
|
||||
Subproject commit d84f25c7a672b687c7f9c9e78a4c97a5586036b0
|
||||
@ -72,28 +72,45 @@ async function classifyIntent(text) {
|
||||
|
||||
const INTENTS = await getIntents();
|
||||
|
||||
let best = {
|
||||
let bestIntent = {
|
||||
name: "unknown",
|
||||
confidence: 0.5,
|
||||
matched: null,
|
||||
argument: null
|
||||
};
|
||||
|
||||
for (const intent of INTENTS) {
|
||||
for (const example of intent.examples) {
|
||||
const exampleEmbedding = await embed(example);
|
||||
const score = cosineSimilarity(inputEmbedding, exampleEmbedding);
|
||||
const intentScore = cosineSimilarity(inputEmbedding, exampleEmbedding);
|
||||
|
||||
if (score > best.confidence) {
|
||||
best = {
|
||||
if (intentScore > bestIntent.confidence) {
|
||||
bestIntent = {
|
||||
name: intent.name,
|
||||
confidence: score,
|
||||
confidence: intentScore,
|
||||
matched: example,
|
||||
argument: intent.arguments
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
let bestArgumentScore = 0.5
|
||||
|
||||
if (bestIntent.argument) {
|
||||
for (const argument of best.arguments) {
|
||||
const argumentEmbedding = await embed(argument);
|
||||
const argumentScore = cosineSimilarity(inputEmbedding, argumentEmbedding);
|
||||
|
||||
if (argumentScore > bestArgumentScore) {
|
||||
bestArgumentScore = argumentScore;
|
||||
|
||||
bestIntent.argument = argument
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bestIntent;
|
||||
}
|
||||
|
||||
async function handleIntent(streamKey, msg) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user