Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
KotGPT
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Michael Pastushkov
KotGPT
Commits
81741ae5
Commit
81741ae5
authored
Aug 18, 2025
by
Michael Pastushkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config
parent
527ec633
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
6 deletions
+16
-6
config/template.json
+7
-0
src/api/ConversationManager.js
+2
-1
src/api/KotGPT.js
+4
-3
src/api/TopicRouter.js
+3
-2
No files found.
config/template.json
View file @
81741ae5
...
@@ -12,6 +12,13 @@
...
@@ -12,6 +12,13 @@
"port"
:
3011
"port"
:
3011
},
},
"ai"
:
{
"endpoint"
:
"http://127.0.0.1:11434"
,
"model"
:
"gpt-oss:120b"
,
"embed_model"
:
"nomic-embed-text"
,
"label_model"
:
"llama3:8b"
},
"housekeeping"
:
{
"housekeeping"
:
{
"cronTime"
:
"0 0 * * * *"
,
"cronTime"
:
"0 0 * * * *"
,
"on_start"
:
false
"on_start"
:
false
...
...
src/api/ConversationManager.js
View file @
81741ae5
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
* Created by: Michael Pastushkov <michael@pastushkov.com>
* Created by: Michael Pastushkov <michael@pastushkov.com>
*/
*/
const
config
=
require
(
'config'
);
const
HistoryManager
=
require
(
'./HistoryManager'
);
const
HistoryManager
=
require
(
'./HistoryManager'
);
const
TopicRouter
=
require
(
'./TopicRouter'
);
const
TopicRouter
=
require
(
'./TopicRouter'
);
const
utils
=
require
(
'../utils/utils'
);
const
utils
=
require
(
'../utils/utils'
);
...
@@ -75,7 +76,7 @@ class ConversationManager {
...
@@ -75,7 +76,7 @@ class ConversationManager {
});
});
// Making the main request to model
// Making the main request to model
const
res
=
await
fetch
(
'http://127.0.0.1:11434/api/chat'
,
{
const
res
=
await
fetch
(
`
${
config
.
ai
.
endpoint
}
/api/chat`
,
{
method
:
'POST'
,
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
},
headers
:
{
'Content-Type'
:
'application/json'
},
body
:
body
body
:
body
...
...
src/api/KotGPT.js
View file @
81741ae5
...
@@ -3,13 +3,14 @@
...
@@ -3,13 +3,14 @@
* Created by: Michael Pastushkov <michael@pastushkov.com>
* Created by: Michael Pastushkov <michael@pastushkov.com>
*/
*/
const
config
=
require
(
'config'
);
const
{
v4
:
uuidv4
}
=
require
(
'uuid'
);
const
{
v4
:
uuidv4
}
=
require
(
'uuid'
);
const
utils
=
require
(
'../utils/utils'
);
const
utils
=
require
(
'../utils/utils'
);
const
ConversationManager
=
require
(
'./ConversationManager'
);
const
ConversationManager
=
require
(
'./ConversationManager'
);
const
MODEL
=
'gpt-oss:20b'
;
// 'llama3:8b'; //
'gpt-oss:20b';
const
MODEL
=
config
.
ai
.
model
||
'gpt-oss:20b'
;
const
EMBED_MODEL
=
'nomic-embed-text'
;
const
EMBED_MODEL
=
config
.
ai
.
embed_model
||
'nomic-embed-text'
;
const
LABEL_MODEL
=
'llama3:8b'
;
const
LABEL_MODEL
=
config
.
ai
.
label_model
||
'llama3:8b'
;
const
sessions
=
new
Map
();
// cookie -> ConversationManager
const
sessions
=
new
Map
();
// cookie -> ConversationManager
//const queues = new Map(); // cookie -> Promise (to serialize)
//const queues = new Map(); // cookie -> Promise (to serialize)
...
...
src/api/TopicRouter.js
View file @
81741ae5
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
* Created by: Michael Pastushkov <michael@pastushkov.com>
* Created by: Michael Pastushkov <michael@pastushkov.com>
*/
*/
const
config
=
require
(
'config'
);
const
utils
=
require
(
'../utils/utils'
);
const
utils
=
require
(
'../utils/utils'
);
class
TopicRouter
{
class
TopicRouter
{
...
@@ -24,7 +25,7 @@ class TopicRouter {
...
@@ -24,7 +25,7 @@ class TopicRouter {
utils
.
log
(
'_mintLabelWithLLM'
,
5
);
utils
.
log
(
'_mintLabelWithLLM'
,
5
);
utils
.
log
(
`model:
${
this
.
labelModel
}
`
,
5
);
utils
.
log
(
`model:
${
this
.
labelModel
}
`
,
5
);
const
sys
=
`Return a short topic key (1–3 words, lowercase, hyphenated). Only the key.`
;
const
sys
=
`Return a short topic key (1–3 words, lowercase, hyphenated). Only the key.`
;
const
r
=
await
fetch
(
'http://127.0.0.1:11434/api/chat'
,
{
const
r
=
await
fetch
(
`
${
config
.
ai
.
endpoint
}
/api/chat`
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
},
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
},
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
model
:
this
.
labelModel
,
model
:
this
.
labelModel
,
...
@@ -92,7 +93,7 @@ class TopicRouter {
...
@@ -92,7 +93,7 @@ class TopicRouter {
async
embed
(
text
)
{
async
embed
(
text
)
{
utils
.
log
(
`Embed
${
text
}
`
,
5
);
utils
.
log
(
`Embed
${
text
}
`
,
5
);
utils
.
log
(
`model:
${
this
.
embedModel
}
`
,
5
);
utils
.
log
(
`model:
${
this
.
embedModel
}
`
,
5
);
const
r
=
await
fetch
(
'http://127.0.0.1:11434/api/embeddings'
,
{
const
r
=
await
fetch
(
`
${
config
.
ai
.
endpoint
}
/api/embeddings`
,
{
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
},
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json'
},
body
:
JSON
.
stringify
({
body
:
JSON
.
stringify
({
model
:
this
.
embedModel
,
model
:
this
.
embedModel
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment