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
7bd1e40b
Commit
7bd1e40b
authored
Aug 17, 2025
by
Michael Pastushkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix clear
parent
efce9518
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
3 deletions
+17
-3
src/api/KotGPT.js
+11
-3
src/api/routes.js
+1
-0
static/www/index.html
+5
-0
static/www/index5.html
+0
-0
No files found.
src/api/KotGPT.js
View file @
7bd1e40b
...
...
@@ -10,7 +10,6 @@ const ConversationManager = require('./ConversationManager');
const
MODEL
=
'gpt-oss:20b'
;
// 'llama3:8b'; // 'gpt-oss:20b';
const
EMBED_MODEL
=
'nomic-embed-text'
;
const
LABEL_MODEL
=
'llama3:8b'
;
const
COOKIE_TIMEOUT
=
1
*
1
*
10
*
60
*
1000
// 10 minutes
const
sessions
=
new
Map
();
// cookie -> ConversationManager
//const queues = new Map(); // cookie -> Promise (to serialize)
...
...
@@ -21,12 +20,11 @@ async function run(req, res) {
let
cookie
=
req
.
cookies
?.
session
;
if
(
!
cookie
)
{
cookie
=
uuidv4
();
res
.
cookie
(
'session'
,
cookie
,
{
maxAge
:
COOKIE_TIMEOUT
});
res
.
cookie
(
'session'
,
cookie
,
{
path
:
'/'
,
sameSite
:
'Lax'
,
httpOnly
:
true
});
utils
.
log
(
`[session] New cookie set:
${
cookie
}
`
,
5
);
}
else
{
utils
.
log
(
`[session] Existing cookie:
${
cookie
}
`
,
5
);
}
// Get conversation manager
let
convman
=
sessions
.
get
(
cookie
);
if
(
!
convman
)
{
...
...
@@ -46,8 +44,16 @@ async function run(req, res) {
async
function
stop
(
req
,
res
)
{
utils
.
log
(
'stop'
);
res
.
send
(
'Stop OK'
);
}
async
function
clear
(
req
,
res
)
{
res
.
clearCookie
(
'session'
,
{
path
:
'/'
,
sameSite
:
'Lax'
,
httpOnly
:
true
});
utils
.
log
(
'clear'
);
res
.
send
(
'Clear OK'
);
}
module
.
exports
=
{
run
,
stop
};
/* Testing * /
...
...
@@ -64,3 +70,5 @@ function log(data) {
/**/
module
.
exports
.
run
=
run
;
module
.
exports
.
stop
=
stop
;
module
.
exports
.
clear
=
clear
;
src/api/routes.js
View file @
7bd1e40b
...
...
@@ -21,6 +21,7 @@ function init(app) {
// Misc
[
POST
,
'/stream'
,
'./KotGPT'
],
[
GET
,
'/stop'
,
'./KotGPT'
,
'stop'
],
[
GET
,
'/clear'
,
'./KotGPT'
,
'clear'
],
// Misc
[
GET
,
'/info'
,
'../common/info'
],
[
GET
,
'/logcat'
,
'../utils/logcat'
],
...
...
static/www/index.html
View file @
7bd1e40b
...
...
@@ -178,6 +178,11 @@
let
controller
=
null
;
window
.
addEventListener
(
'DOMContentLoaded'
,
async
()
=>
{
try
{
await
fetch
(
'/api/clear'
,
{
method
:
'GET'
});
}
catch
(
err
)
{
// nothing to do
}
await
loadLocale
(
CURRENT_LOCALE
);
inputText
.
focus
();
});
...
...
static/www/index5.html
0 → 100755
View file @
7bd1e40b
This diff is collapsed.
Click to expand it.
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