diff --git a/Readme.md b/Readme.md index 44f56e1..1cc48b6 100644 --- a/Readme.md +++ b/Readme.md @@ -1,8 +1,63 @@ # Calculator-Example -This is a simple example of an calculator agent system using the [Agents Platform](https://git.chai.uni-hamburg.de/UMS-Agenten/Agenten-Plattform) and based on [Agent Template](https://git.chai.uni-hamburg.de/UMS-Agenten/Agent-Template). +This is a simple example of an calculator "agent system" using the [Agents Platform](https://git.chai.uni-hamburg.de/UMS-Agenten/Agenten-Plattform) and based on [Agent Template](https://git.chai.uni-hamburg.de/UMS-Agenten/Agent-Template). Start by `docker compose up` and open web interface of management at . -## Riddle Example +## Calculator +A riddle is a math expression, e.g., `x * y =` and the values of the variables `x` and `y` are defined via text files. +For example a line `x = 12` in text file assigns the value to `12` to the variable `x`. + +For example, the result of a riddle `x * x =` would be `144` with the explanation `12 * 12 = 144`. + +## Riddle Example +In this example the values of the variables are [`x = 10`](./data/share/example/x.txt), [`y = 15`](./data/share/example/y.txt), [`z = 20`](./data/share/example/z.txt), see the files in [`./data/share/example/`](./data/share/example/). + +1. You may send a riddle to the management using the web interface () and press "Send Message" + ![](./webinterface_new_riddle.png) +2. The message to the management will look like: + ```json + { + "id": "test1", + "sub_ids": [], + "riddle": { + "context": "", + "question": "y + x =", + "solutions_before": [] + }, + "solution": [], + "data": [ + { + "type": "text", + "file_plain": "example/z.txt", + "file_extracted": null + }, + { + "type": "text", + "file_plain": "example/y.txt", + "file_extracted": null + } + ], + "status": { + "extract": { + "required": true, + "finished": false + }, + "solve": { + "required": true, + "finished": false + }, + "validate": { + "required": true, + "finished": false + }, + "trial": 0, + "solved": false + }, + "contacts": 0 + } + ``` +3. Message will be send between agents for solving the riddle. +4. Result can be found in web interface () + ![](./webinterface_result.png) \ No newline at end of file diff --git a/src/extract/agent.py b/src/extract/agent.py index ee27ec6..54b23db 100644 --- a/src/extract/agent.py +++ b/src/extract/agent.py @@ -21,11 +21,8 @@ class CalculatorExtractVariables(ExtractTextAgent): variable, value = match.group(1), int(match.group(2)) data.file_extracted = self.store_extracted(data, ExtractedData( - contents=[ - ExtractedContent(type="variable", content=variable), - ExtractedContent(type="value", content=value) - ] - )) + other={"variable" : variable, "value" : value} + )) return data diff --git a/webinterface_new_riddle.png b/webinterface_new_riddle.png new file mode 100644 index 0000000..a990bbd Binary files /dev/null and b/webinterface_new_riddle.png differ diff --git a/webinterface_result.png b/webinterface_result.png new file mode 100644 index 0000000..d7b099a Binary files /dev/null and b/webinterface_result.png differ