从program-y的convo文件中读回用户的属性

时间:2018-09-20 08:11:37

标签: python-3.x chatbot

我正在尝试保存和读取文件中的用户属性。 目前,我可以将他的属性保存到纯文本文件中。 我曾尝试阅读official document,但由于正在开发中,所以找不到答案

config.yml

brain:

    # Overrides
    overrides:
      allow_system_aiml: true
      allow_learn_aiml: true
      allow_learnf_aiml: true

    # Defaults
    defaults:
      default-get: unknown
      default-property: unknown
      default-map: unknown
      learnf-path: $BOT_ROOT/aimlf

    # Nodes
    nodes:
      pattern_nodes: $BOT_ROOT/config/pattern_nodes.conf
      template_nodes: $BOT_ROOT/config/template_nodes.conf

    # Binary
    binaries:
      save_binary: false
      load_binary: false
      binary_filename: /tmp/y-bot.brain
      load_aiml_on_binary_fail: false

    # Braintree
    braintree:
      file: /tmp/braintree.xml
      content: xml

    files:
        aiml:
            files: $BOT_ROOT/aiml
            extension: .aiml
            directories: true
            errors:
              file: /tmp/y-bot_errors.csv
              format: csv
              encoding: utf-8
              delete_on_start: false
            duplicates:
              file: /tmp/y-bot_duplicates.csv
              format: csv
              encoding: utf-8
              delete_on_start: false
            conversations:

              # User's properties
              type: file
              config_name: file_storage
              empty_on_start: false
              file_storage:
                dir: $BOT_ROOT/conversations
            # Bot's properties
            properties: $BOT_ROOT/config/properties.txt

Console.convo

topic:*
gender:MALE
name:john
lastname:conor
gendername:I like to stay informed.
firstname:friend

问题:
如何将用户的属性加载回bot?

1 个答案:

答案 0 :(得分:0)

我的完整config.yaml文件具有较高的嵌套部分。它是y-bot的副本。但是现在它已经从存储库中消失了。

conversations:
  type: file
  config_name: file_storage
  empty_on_start: true

只需将true更改为false。仅此而已!