commit
b2cd4a128b
@ -11,6 +11,7 @@ import datetime
|
|||||||
import asyncio
|
import asyncio
|
||||||
import requests
|
import requests
|
||||||
import markdown
|
import markdown
|
||||||
|
|
||||||
class ollamarama:
|
class ollamarama:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
#load config file
|
#load config file
|
||||||
@ -67,7 +68,8 @@ class ollamarama:
|
|||||||
await self.client.room_send(
|
await self.client.room_send(
|
||||||
room_id=channel,
|
room_id=channel,
|
||||||
message_type="m.room.message",
|
message_type="m.room.message",
|
||||||
content={"msgtype": "m.text",
|
content={
|
||||||
|
"msgtype": "m.text",
|
||||||
"body": message,
|
"body": message,
|
||||||
"format": "org.matrix.custom.html",
|
"format": "org.matrix.custom.html",
|
||||||
"formatted_body": markdown.markdown(message, extensions=['fenced_code', 'nl2br'])},
|
"formatted_body": markdown.markdown(message, extensions=['fenced_code', 'nl2br'])},
|
||||||
@ -110,7 +112,7 @@ class ollamarama:
|
|||||||
"repeat_penalty": self.repeat_penalty
|
"repeat_penalty": self.repeat_penalty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response = requests.post(self.api_url, json=data, timeout=60)
|
response = requests.post(self.api_url, json=data, timeout=120)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
@ -316,6 +318,7 @@ class ollamarama:
|
|||||||
if sender in self.messages[room_id]:
|
if sender in self.messages[room_id]:
|
||||||
self.messages[room_id][sender].clear()
|
self.messages[room_id][sender].clear()
|
||||||
await self.persona(room_id, sender, self.personality)
|
await self.persona(room_id, sender, self.personality)
|
||||||
|
del self.messages[room_id][sender][1]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.send_message(room_id, f"{self.bot_id} reset to default for {sender_display}")
|
await self.send_message(room_id, f"{self.bot_id} reset to default for {sender_display}")
|
||||||
|
Loading…
Reference in New Issue
Block a user