Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 2.18 KB

README.md

File metadata and controls

47 lines (37 loc) · 2.18 KB

Description

An OpenAI QML plugin that could be used in Qt-based projects.

Features

Authentication

Make sure you defined OPENAI_API_KEY environment. You could also do that active kit's run configuration on Qt Creator:

Projects -> Your kit -> Run -> Environment -> Details -> Add: OPENAI_API_KEY="your-key"

How to link qopenai

  • Copy qopenai folder under your project's root directory
  • Add qopenai as a sub-directory in project's root CMakeLists.txt file after creating executable for your target(see qt_add_executable):
add_subdirectory(qopenai)
  • Link required Qt modules and qopenaiplugin to the target:
target_link_libraries(appexample PRIVATE qopenaiplugin)
  • Should you be interested in using this plugin as a library and instantiate them in C++, link it to the target with qopenai name instead of qopenaiplugin as below:
target_link_libraries(appexample PRIVATE qopenai)
  • Then include directories for target to be able to #include and instantiate them in C++:
target_include_directories(qopenai PUBLIC ${CMAKE_SOURCE_DIR}/qopenai "${CMAKE_BINARY_DIR}/qopenai")

Appendix

  • Example app tested on Windows, OSX and iOS platforms with Qt's 6.5.0 kit.

"Buy Me A Coffee"