2023-02-06 21:54:41 +10:00
|
|
|
|
import openai
|
2023-06-20 13:21:28 +10:00
|
|
|
|
from aiogram import types
|
|
|
|
|
from create_bot import dp
|
2023-02-06 21:54:41 +10:00
|
|
|
|
|
|
|
|
|
token = '5947963644:AAF_GKgMmU5ovqMpc1KXIpcf4aN0JMyKPqc'
|
|
|
|
|
openai.api_key = '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'
|
|
|
|
|
|
2023-06-20 13:21:28 +10:00
|
|
|
|
|
2023-02-06 21:54:41 +10:00
|
|
|
|
@dp.message_handler()
|
2023-02-06 22:45:18 +10:00
|
|
|
|
async def send(message: types.Message):
|
2023-02-06 21:54:41 +10:00
|
|
|
|
if 'тупица' in message.text.lower():
|
|
|
|
|
|
|
|
|
|
response = openai.Completion.create(
|
2023-06-20 13:21:28 +10:00
|
|
|
|
model="text-davinci-003",
|
|
|
|
|
prompt=message.text[7:],
|
|
|
|
|
temperature=0.7,
|
|
|
|
|
max_tokens=1000,
|
|
|
|
|
top_p=1.0,
|
|
|
|
|
frequency_penalty=0.0,
|
|
|
|
|
presence_penalty=0.6,
|
|
|
|
|
stop=["сброс"]
|
2023-02-06 23:10:13 +10:00
|
|
|
|
)
|
2023-02-06 21:54:41 +10:00
|
|
|
|
await message.reply(response['choices'][0]['text'])
|
2023-02-06 22:45:18 +10:00
|
|
|
|
|
2023-02-06 21:54:41 +10:00
|
|
|
|
|
|
|
|
|
|