-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
43 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from david.adapters.adapter import Adapter, MessageAdapter | ||
from david.adapters.adapters.google import GoogleAdapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from typing import Dict | ||
|
||
from david.adapters.adapter import Adapter | ||
from david.registry import Registry | ||
from david.typing import Message | ||
|
||
|
||
class GoogleAdapter(Adapter): | ||
@classmethod | ||
def name(cls): | ||
return "google" | ||
|
||
@classmethod | ||
def validade_data(cls, payload: Dict) -> bool: | ||
return "queryResult" in payload and "queryText" in payload["queryResult"] | ||
|
||
@classmethod | ||
def input(cls, payload: Dict) -> Message: | ||
input = payload["queryResult"]["queryText"] | ||
return Message.build(input) | ||
|
||
@classmethod | ||
def output(cls, message: Message) -> Dict: | ||
return {"fulfillmentText": message.output["text"]} | ||
|
||
|
||
Registry.registryAdapter(GoogleAdapter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ | |
DEFAULT_LOG_LEVEL = "INFO" | ||
|
||
ENV_LOG_LEVEL = "LOG_LEVEL" | ||
|
||
CONFIG_DEFAULT_ADAPTER = "default_adapter" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters