mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Add an experimental option for "AI Tools" button.
This commit is contained in:
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "ui/controls/compose_ai_button_factory.h"
|
||||
|
||||
#include "base/options.h"
|
||||
#include "boxes/compose_ai_box.h"
|
||||
#include "history/view/controls/history_view_compose_ai_button.h"
|
||||
#include "lang/lang_keys.h"
|
||||
@@ -19,10 +20,19 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace Ui {
|
||||
|
||||
const char kOptionHideAiButton[] = "hide-ai-button";
|
||||
|
||||
base::options::toggle HideAiButtonOption({
|
||||
.id = kOptionHideAiButton,
|
||||
.name = "Hide AI button",
|
||||
.description = "Hide the AI Tools button in message compose fields.",
|
||||
});
|
||||
|
||||
bool HasEnoughLinesForAi(
|
||||
not_null<Main::Session*> session,
|
||||
not_null<Ui::InputField*> field) {
|
||||
if (session->appConfig().aiComposeStyles().empty()) {
|
||||
if (HideAiButtonOption.value()
|
||||
|| session->appConfig().aiComposeStyles().empty()) {
|
||||
return false;
|
||||
}
|
||||
const auto &style = field->st().style;
|
||||
|
||||
@@ -23,6 +23,8 @@ class ComposeAiButton;
|
||||
|
||||
namespace Ui {
|
||||
|
||||
extern const char kOptionHideAiButton[];
|
||||
|
||||
[[nodiscard]] bool HasEnoughLinesForAi(
|
||||
not_null<Main::Session*> session,
|
||||
not_null<Ui::InputField*> field);
|
||||
|
||||
Reference in New Issue
Block a user