diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index a07566c0e..f34249532 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -65,8 +65,7 @@ add_library(${TARGET} STATIC train.cpp ngram-cache.h ngram-cache.cpp - chaton.hpp - groupkv.hpp + chaton_meta.cpp ) if (BUILD_SHARED_LIBS) diff --git a/common/chaton.hpp b/common/chaton.hpp index 17bd59be7..b2046d198 100644 --- a/common/chaton.hpp +++ b/common/chaton.hpp @@ -537,9 +537,8 @@ public: }; -// The compiled-in configurable template data (the meta) -#include "chaton_meta.hpp" -//ChatTemplates gCT = {{}}; +// The compiled-in configurable template data (the meta) from chaton_meta.cpp +extern ChatTemplates gCT; inline bool chaton_tmpl_exists(const std::string &tmpl) { diff --git a/common/chaton_meta.hpp b/common/chaton_meta.cpp similarity index 99% rename from common/chaton_meta.hpp rename to common/chaton_meta.cpp index 3516d5bb9..d0013b519 100644 --- a/common/chaton_meta.hpp +++ b/common/chaton_meta.cpp @@ -1,5 +1,4 @@ //This is auto created/converted from chaton-meta-json file -#pragma once #include "chaton.hpp" diff --git a/scripts/chaton-meta-json-to-hpp.py b/scripts/chaton-meta-json-to-hpp.py index d72c4cdf5..3329b9b7f 100755 --- a/scripts/chaton-meta-json-to-hpp.py +++ b/scripts/chaton-meta-json-to-hpp.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Convert chaton meta json file to c++ hpp file +# Convert chaton meta json file to equivalent c++ cpp format # by Humans for All import sys @@ -19,7 +19,7 @@ def kv_bool(j, tmpl, k1, comma): fp=open(sys.argv[1]) j=json.load(fp) print("//This is auto created/converted from chaton-meta-json file") -print("#pragma once\n\n#include \"chaton.hpp\"\n\nChatTemplates gCT = {{") +print("\n\n#include \"chaton.hpp\"\n\nChatTemplates gCT = {{") for tmpl in j: print("\t{{ \"{}\", {{".format(tmpl))