seawolf2357
commited on
Commit
β’
672b059
1
Parent(s):
1e4bf1a
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import asyncio
|
|
7 |
import subprocess
|
8 |
|
9 |
# λ‘κΉ
μ€μ
|
10 |
-
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s
|
11 |
|
12 |
# μΈν
νΈ μ€μ
|
13 |
intents = discord.Intents.default()
|
@@ -39,6 +39,11 @@ class MyClient(discord.Client):
|
|
39 |
subprocess.Popen(["python", "web.py"])
|
40 |
logging.info("Web.py server has been started.")
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
async def on_message(self, message):
|
43 |
if message.author == self.user:
|
44 |
return
|
@@ -82,13 +87,8 @@ async def extract_keywords(message):
|
|
82 |
response = await loop.run_in_executor(None, lambda: hf_client.chat_completion(
|
83 |
messages, max_tokens=10, temperature=0.7, top_p=0.85))
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
logging.debug(f'Part received from stream: {part}')
|
88 |
-
if part.choices and part.choices[0].delta and part.choices[0].delta.content:
|
89 |
-
full_response.append(part.choices[0].delta.content)
|
90 |
-
|
91 |
-
keywords = ''.join(full_response).strip()
|
92 |
logging.debug(f'Extracted keywords: {keywords}')
|
93 |
return keywords
|
94 |
|
|
|
7 |
import subprocess
|
8 |
|
9 |
# λ‘κΉ
μ€μ
|
10 |
+
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s:%(message)s', handlers=[logging.StreamHandler()])
|
11 |
|
12 |
# μΈν
νΈ μ€μ
|
13 |
intents = discord.Intents.default()
|
|
|
39 |
subprocess.Popen(["python", "web.py"])
|
40 |
logging.info("Web.py server has been started.")
|
41 |
|
42 |
+
# λ΄μ΄ μμλ λ μλ΄ λ©μμ§λ₯Ό μ μ‘
|
43 |
+
channel = self.get_channel(SPECIFIC_CHANNEL_ID)
|
44 |
+
if channel:
|
45 |
+
await channel.send("μ°Ύκ³ μΆμ μ¬μ§μ λν μ€λͺ
μ ν λ¬Έμ₯ λ¨μλ‘ μ
λ ₯νμΈμ. μ) λλ°μ λ°μ΄ λκ³ μλ νμ€ν€")
|
46 |
+
|
47 |
async def on_message(self, message):
|
48 |
if message.author == self.user:
|
49 |
return
|
|
|
87 |
response = await loop.run_in_executor(None, lambda: hf_client.chat_completion(
|
88 |
messages, max_tokens=10, temperature=0.7, top_p=0.85))
|
89 |
|
90 |
+
# LLM μλ΅μ ν
μ€νΈμΌ μ μμΌλ―λ‘ λ¨μν κ²°ν©νμ¬ λ°ν
|
91 |
+
keywords = response.strip()
|
|
|
|
|
|
|
|
|
|
|
92 |
logging.debug(f'Extracted keywords: {keywords}')
|
93 |
return keywords
|
94 |
|