do you guys know why this happened?
ERROR asyncio - Task exception was never retrieved
future: <Task finished name='Task-9' coro=<SignalRouter._dispatch() done, defined at D:\Python\lib\site-packages\sanic\signals.py:121> exception=ClientResponseError(RequestInfo(url=URL('http://localhost:5005/webhooks/rest/webhook?stream=true&token='), method='POST', headers=<CIMultiDictProxy('Host': 'localhost:5005', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.10 aiohttp/3.8.4', 'Content-Length': '83', 'Content-Type': 'application/json')>, real_url=URL('http://localhost:5005/webhooks/rest/webhook?stream=true&token=')), (), status=503, message='Service Unavailable', headers=<CIMultiDictProxy('Content-Length': '79', 'Connection': 'close', 'Content-Type': 'application/json')>)>
Traceback (most recent call last):
File "D:\Python\lib\site-packages\sanic\signals.py", line 161, in _dispatch
retval = await maybe_coroutine
File "D:\Python\lib\site-packages\sanic\app.py", line 1581, in run_delayed_task
await prepped
File "D:\Python\lib\site-packages\rasa\core\run.py", line 137, in run_cmdline_io
await console.record_messages(
File "D:\Python\lib\site-packages\rasa\core\channels\console.py", line 218, in record_messages
async for response in bot_responses_stream:
File "D:\Python\lib\site-packages\rasa\core\channels\console.py", line 164, in _send_message_receive_stream
async with session.post(url, json=payload, raise_for_status=True) as resp:
File "D:\Python\lib\site-packages\aiohttp\client.py", line 1141, in aenter
self._resp = await self._coro
File "D:\Python\lib\site-packages\aiohttp\client.py", line 643, in _request
resp.raise_for_status()
File "D:\Python\lib\site-packages\aiohttp\client_reqrep.py", line 1005, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 503, message='Service Unavailable', url=URL('http://localhost:5005/webhooks/rest/webhook?stream=true&token=')
2023-03-02 11:42:38 ERROR rasa.core.processor - Encountered an exception while running action 'action_akar_kata'.Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
File "D:\Python\lib\site-packages\rasa\core\processor.py", line 874, in _run_action
events = await action.run(
File "D:\Python\lib\site-packages\rasa\core\actions\action.py", line 759, in run
response: Any = await self.action_endpoint.request(
File "D:\Python\lib\site-packages\rasa\utils\endpoints.py", line 164, in request
async with session.request(
File "D:\Python\lib\site-packages\aiohttp\client.py", line 1141, in aenter
self._resp = await self._coro
File "D:\Python\lib\site-packages\aiohttp\client.py", line 560, in _request
await resp.start(conn)
File "D:\Python\lib\site-packages\aiohttp\client_reqrep.py", line 894, in start
with self._timer:
File "D:\Python\lib\site-packages\aiohttp\helpers.py", line 721, in exit
raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
Action.py
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
import json
# import requests
class akarkata:
nomor: int
akar: str
makna: str
jilid: int
halaman: int
author: int
def __init__(self, nomor: int, akar: str, makna: str, jilid: int, halaman: int, author: int) -> None:
self.nomor = nomor
self.akar = akar
self.makna = makna
self.jilid = jilid
self.halaman = halaman
self.author = author
class ActionAkarKata(Action):
def name(self) -> Text:
return "action_akar_kata"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
# membaca file JSON
with open("QuraniDB_json/akar_kata.json","r") as f:
akar_kata_json = json.load(f)
data = []
for d in akar_kata_json:
welcome8element = akarkata(d["nomor"], d["akar"], d["makna"], d["jilid"], d["halaman"], d["author"])
data.append(welcome8element)
return data
class ActionShowAkarKata(Action):
def name(self) -> Text:
return "action_show_akar_kata"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
data = self.run() # panggil fungsi untuk mengambil data
for d in data:
hasilak = f"Nomor: {d.nomor}\nAkar: {d.akar}\nMakna: {d.makna}\nJilid: {d.jilid}\nHalaman: {d.halaman}\nAuthor: {d.author}"
dispatcher.utter_message(hasilak)
return []
nlu.yml
- intent: informasi_akar
examples: |
- tolong cari akar kata dengan nomor [2](nomor)
- cari akar kata nomor [3](nomor)
- informasi akar kata dengan nomor [4](nomor)
- apa itu akar kata dengan nomor [5](nomor)?
- cek informasi akar kata nomor [6](nomor)
- carikan informasi akar kata nomor [7](nomor) untuk saya
- saya butuh informasi akar kata dengan nomor [8](nomor)
domain.yml
intents:
- informasi_akar
entities:
- nomor
slots:
akar_kata:
type: text
influence_conversation: false
mappings:
- type: from_entity
entity: nomor
actions:
- utter_akarkata
- action_akar_kata
- action_show_akar_kata
responses:
utter_akarkata:
- text: "Hasil:\n {nomor}\n {akar}\n {makna}\n {jilid}\n {halaman}"
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: true
endpoint.yml
action_endpoint:
url: "http://localhost:5055/webhook"
credentials.yml
socketio:
user_message_evt: user_uttered
bot_message_evt: bot_uttered
session_persistence: true
# This entry is needed if you are using Rasa Enterprise. The entry represents credentials
# for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers.
rasa:
url: "http://localhost:5034/api"
config.yml
recipe: default.v1
# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
# # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
# # If you'd like to customize it, uncomment and adjust the pipeline.
# # See https://rasa.com/docs/rasa/tuning-your-model for more information.
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
constrain_similarities: true
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 100
constrain_similarities: true
- name: FallbackClassifier
threshold: 0.3
ambiguity_threshold: 0.1
policies:
# # No configuration for policies was provided. The following default policies were used to train your model.
# # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information.
- name: MemoizationPolicy
- name: RulePolicy
- name: UnexpecTEDIntentPolicy
max_history: 5
epochs: 100
- name: TEDPolicy
max_history: 5
epochs: 100
constrain_similarities: true
rules.yml
- rule: akar kata
steps:
- intent: informasi_akar
- slot_was_set:
- akar_kata: "ابب"
- action: action_akar_kata
- action: action_show_akar_kata
- slot_was_set:
- akar_kata: null
QuraniDB.json/akar_kata.json
[
{
"nomor": 1,
"akar": "-",
"makna": "-",
"jilid": 0,
"halaman": 0,
"author": 0
},
{
"nomor": 2,
"akar": "ابب",
"makna": "padang rumput yang telah siap untuk dijadikan tempat menggembala dan mengambil rumput.",
"jilid": 1,
"halaman": 15,
"author": 1
}
]
I think the logic is like this: the data will be called by python then it will be sent to the chatbot flavour.