turing-machines / mentals-ai

Agents in Markdown syntax (loops, memory and tools included)
https://x.com/mentals_ai
MIT License
349 stars 32 forks source link

fix compiler errors, gitignore config.toml and move to sample file #20

Open Reksa97 opened 2 months ago

Reksa97 commented 2 months ago

Config files with sensitive data like api keys should be kept in a gitignored file to avoid leaking the keys, so I renamed config.toml to config.toml.sample and added config.toml to .gitignore.

Also got some errors (M1 Macbook, using VSCode C++ dev container) during compilation so fixed those.

/mentals-ai $ make
Using compiler: g++ version 11
mkdir -p build/./src/
g++ -DLINUX -I./src -I./src/tl -I./src/nlohmann -I./src/liboai -I./src/liboai/core -I./src/liboai/include -I./src/liboai/include/core -I./src/liboai/include/components -I./src/liboai/components -I./src/treehh -I./src/toml++ -I./src/toml++/impl -I/usr/include/poppler/cpp -I/usr/include/poppler -MMD -MP  -std=c++20 -Wall -Wextra -O3 -march=native  -c src/pgvector.cpp -o build/./src/pgvector.cpp.o
src/pgvector.cpp: In function ‘json pqxx_result_to_json(const pqxx::result&)’:
src/pgvector.cpp:35:37: warning: comparison of integer expressions of different signedness: ‘int’ and ‘pqxx::row::size_type’ {aka ‘unsigned int’} [-Wsign-compare]
   35 |         for (int colnum = 0; colnum < row.size(); ++colnum) {
      |                              ~~~~~~~^~~~~~~~~~~~
src/pgvector.cpp: In member function ‘tl::expected<void, std::__cxx11::basic_string<char> > PgVector::write_content(pqxx::work&, const string&, const string&, int, const string&, const vdb::vector&, const std::optional<std::__cxx11::basic_string<char> >&, const std::optional<std::__cxx11::basic_string<char> >&)’:
src/pgvector.cpp:166:45: error: ‘class std::basic_ostream<char>’ has no member named ‘str’
  166 |         (std::ostringstream() << embedding).str());
      |                                             ^~~
src/pgvector.cpp:149:15: warning: unused parameter ‘chunk_id’ [-Wunused-parameter]
  149 |     const int chunk_id,
      |     ~~~~~~~~~~^~~~~~~~
src/pgvector.cpp: In member function ‘tl::expected<nlohmann::json_abi_v3_11_2::basic_json<>, std::__cxx11::basic_string<char> > PgVector::search_content(const string&, const vdb::vector&, int, vdb::query_type)’:
src/pgvector.cpp:201:85: error: ‘class std::basic_ostream<char>’ has no member named ‘str’
  201 |     pqxx::result res = txn.exec_params(sql, (std::ostringstream() << search_vector).str());