Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ETProvider
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Eppelt
ETProvider
Commits
dd606432
Commit
dd606432
authored
2 months ago
by
Jonas Eppelt
Browse files
Options
Downloads
Patches
Plain Diff
bugfix
parent
643af062
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ChatETProvider.py
+40
-30
40 additions, 30 deletions
ChatETProvider.py
with
40 additions
and
30 deletions
ChatETProvider.py
+
40
−
30
View file @
dd606432
...
...
@@ -66,24 +66,7 @@ class ChatETProvider(BaseProvider, ChatOllama):
model_id_key
=
"
ChatETP
"
model_id_label
=
"
ChatETP version
"
models
=
[
"
*
"
]
model_list
=
[
"
deepseek-r1:1.5b
"
,
"
deepseek-r1:7b
"
,
"
deepseek-r1:8b
"
,
"
deepseek-r1:14b
"
,
"
deepseek-coder-v2:16b
"
,
"
llama3.3
"
,
"
mistral
"
,
"
codellama:7b
"
,
"
codellama:13b
"
,
"
r1-1776:70b
"
,
"
codellama:34b
"
,
"
codellama:70b
"
,
]
models
=
[
"
*
"
]
persona
=
Persona
(
name
=
"
ChatETP
"
,
avatar_route
=
"
api/ai/static/jupyternaut.svg
"
,
...
...
@@ -95,7 +78,24 @@ class ChatETProvider(BaseProvider, ChatOllama):
# TextField(key="model", label="Model ID", format="text"),
]
help
:
str
=
(
"
available models:
"
+
"
,
\n
"
.
join
(
models
)
+
""
"
available models:
"
+
"
,
\n
"
.
join
(
[
"
deepseek-r1:1.5b
"
,
"
deepseek-r1:7b
"
,
"
deepseek-r1:8b
"
,
"
deepseek-r1:14b
"
,
"
deepseek-coder-v2:16b
"
,
"
llama3.3
"
,
"
mistral
"
,
"
codellama:7b
"
,
"
codellama:13b
"
,
"
r1-1776:70b
"
,
"
codellama:34b
"
,
"
codellama:70b
"
,
]
)
+
""
)
base_url
:
str
=
"
deepthought.etp.kit.edu:11434
"
# format:str = "json"
...
...
@@ -152,18 +152,28 @@ class ChatETProvider(BaseProvider, ChatOllama):
from
jupyter_ai.chat_handlers.base
import
BaseChatHandler
,
SlashCommandRoutingType
from
jupyter_ai.models
import
HumanChatMessage
from
jupyter_ai.chat_handlers.default
import
DefaultChatHandler
from
jupyterlab_chat.models
import
Message
,
NewMessage
,
User
from
jupyterlab_chat.ychat
import
YChat
class
ChatETP
(
BaseChatHandler
):
id
=
"
ChatETP
"
name
=
"
ChatETP
"
help
=
"
A chat handler that does something custom
"
routing_type
=
SlashCommandRoutingType
(
slash_id
=
"
custom
"
)
class
ChatETPHandler
(
DefaultChatHandler
):
id
=
"
ChatETPHandler
"
name
=
"
ChatETPHandler
"
help
=
"
ChatETP helps you do Moder method of datanalysis
"
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
def
reply
(
self
,
body
:
str
,
_human_message
=
None
)
->
str
:
"""
Adds a message to the YChat shared document that this chat handler is
assigned to. Returns the new message ID.
async
def
process_message
(
self
,
message
:
HumanChatMessage
):
# Put your custom logic here
print
(
message
)
print
(
self
.
reply
(
"
I am a custom chat handler
"
,
message
))
TODO: Either properly store & use reply state in YChat, or remove the
`human_message` argument here.
"""
bot
=
self
.
ychat
.
get_user
(
BOT
[
"
username
"
])
if
not
bot
:
self
.
ychat
.
set_user
(
User
(
**
BOT
))
t
=
NewMessage
(
body
=
body
,
sender
=
BOT
[
"
username
"
])
print
(
t
)
id
=
self
.
ychat
.
add_message
(
t
)
return
id
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment