<commit_before>(ns yetibot.core.init
  (:require
    [yetibot.core.chat :as chat]
    [yetibot.core.adapters.init :as ai]
    [clojure.stacktrace :refer [print-stack-trace]]
    [clojure.tools.nrepl.server :refer [start-server stop-server]]
    [yetibot.core.config-mutable :as mconfig]
    [yetibot.core.db :as db]
    [taoensso.timbre :refer [info warn error]]
    [yetibot.core.logging :as logging]
    [yetibot.core.webapp.handler :as web]
    [yetibot.core.loader :refer [load-commands-and-observers]]
    [yetibot.core.handler :refer [handle-unparsed-expr]]
    [yetibot.core.logo :refer [logo]])
  (:gen-class))

(defn welcome-message! []
  (println logo))

(defn -main [& args]
  ;; only continue if able to load config
  (if-let [c (mconfig/reload-config!)]
    (do
      (welcome-message!)
      (start-server :port 6789)
      (web/start-web-server)
      (db/start)
      (logging/start)
      (ai/start)
      (load-commands-and-observers))
    (do
      (error "Yetibot failed to start: please ensure config is in place at" (mconfig/config-path) " and that it is well-formed (see the log above for details)")
      (shutdown-agents))))
<commit_msg>Prevent IPV6 issues with nrepl start-server<commit_after>(ns yetibot.core.init
  (:require
    [yetibot.core.chat :as chat]
    [yetibot.core.adapters.init :as ai]
    [clojure.stacktrace :refer [print-stack-trace]]
    [clojure.tools.nrepl.server :refer [start-server stop-server]]
    [yetibot.core.config-mutable :as mconfig]
    [yetibot.core.db :as db]
    [taoensso.timbre :refer [info warn error]]
    [yetibot.core.logging :as logging]
    [yetibot.core.webapp.handler :as web]
    [yetibot.core.loader :refer [load-commands-and-observers]]
    [yetibot.core.handler :refer [handle-unparsed-expr]]
    [yetibot.core.logo :refer [logo]])
  (:gen-class))

(defn welcome-message! []
  (println logo))

(defn -main [& args]
  ;; only continue if able to load config
  (if-let [c (mconfig/reload-config!)]
    (do
      (welcome-message!)
      ;; Note: if you don't set :bind it defaults to :: which may not work if it
      ;; resolves to an IPV6 stack and you're running in Docker
      (start-server :port 6789 :bind "localhost")
      (web/start-web-server)
      (db/start)
      (logging/start)
      (ai/start)
      (load-commands-and-observers))
    (do
      (error "Yetibot failed to start: please ensure config is in place at" (mconfig/config-path) " and that it is well-formed (see the log above for details)")
      (shutdown-agents))))

{'fraction_non_alphanumeric': 0.14143822010329757, 'fraction_numerical': 0.003972983710766786, 'mean_word_length': 3.134646962233169, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4089538', 'n_tokens_mistral': 927, 'n_tokens_neox': 907, 'n_words': 224}