silly chats
parent
cefde486f6
commit
de6f9efbed
18
news/main.py
18
news/main.py
|
@ -9,10 +9,11 @@ import discord
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
import re
|
import re
|
||||||
from pool import PlaywrightPool, ArticleRepository
|
from pool import PlaywrightPool, ArticleRepository
|
||||||
import trafilatura
|
|
||||||
import io
|
import io
|
||||||
|
from ollama import chat
|
||||||
from playwright.async_api import async_playwright, Browser, BrowserContext, Page
|
from ollama import ChatResponse
|
||||||
|
from ollama import Client
|
||||||
|
from ollama import AsyncClient
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
@ -33,6 +34,17 @@ logging.basicConfig(
|
||||||
|
|
||||||
article_repository = ArticleRepository()
|
article_repository = ArticleRepository()
|
||||||
|
|
||||||
|
async def send_chat(messages):
|
||||||
|
return await AsyncClient(host="192.168.69.3:11434").chat(
|
||||||
|
model="deepseek-r1:8b",
|
||||||
|
messages=messages,
|
||||||
|
stream=False,
|
||||||
|
options={
|
||||||
|
'temperature': 0.5,
|
||||||
|
"num_ctx": 128000
|
||||||
|
},
|
||||||
|
think=True)
|
||||||
|
|
||||||
async def send_text_file(channel: discord.abc.Messageable, content: str, filename: str = "article.md") -> None:
|
async def send_text_file(channel: discord.abc.Messageable, content: str, filename: str = "article.md") -> None:
|
||||||
fp = io.BytesIO(content.encode("utf-8"))
|
fp = io.BytesIO(content.encode("utf-8"))
|
||||||
file = discord.File(fp, filename=filename)
|
file = discord.File(fp, filename=filename)
|
||||||
|
|
Loading…
Reference in New Issue