diff --git a/App.cpp b/App.cpp index 3b144ca..3017c9e 100644 --- a/App.cpp +++ b/App.cpp @@ -31,10 +31,9 @@ void App::AboutRequested() { BAboutWindow *about = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("DumBer"), kApplicationSignature); about->AddDescription(B_TRANSLATE("about_body")); - about->AddCopyright(2024, "Santiago Lema"); + about->AddCopyright(2024-2025, "Santiago Lema"); about->AddText("e-mail me at haiku@lema.org"); - about->AddText("or find me on the fediverse as"); - about->AddText("@santi@go.lema.org"); + about->AddText("or find me on the fediverse as\n@santi@go.lema.org"); about->Show(); } diff --git a/Conversation.cpp b/Conversation.cpp index 9cdbfee..7431597 100644 --- a/Conversation.cpp +++ b/Conversation.cpp @@ -270,7 +270,9 @@ void Conversation::ask(const std::string &prompt) { auto url = BUrl("https://api.openai.com/v1/chat/completions"); BHttpRequest request = BHttpRequest(url); request.SetMethod(BHttpMethod::Post); - + //Allow up to 2 minute before timeout, it can be long depending on load or complexity of prompt + request.SetTimeout(120*1000000); + BHttpFields fields = BHttpFields(); fields.AddField("Authorization", buildBearerKey()); // fields.AddField("Content-Type", "application/json"); //NO, this will diff --git a/DumBer b/DumBer index b044862..fd56a44 100755 Binary files a/DumBer and b/DumBer differ diff --git a/MainWindow.cpp b/MainWindow.cpp index 3df144f..a99da81 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -44,7 +44,7 @@ MainWindow::MainWindow() BLayoutBuilder::Group<>(this, B_VERTICAL, 0).Add(menuBar).AddGlue().End(); _inputField = new BTextView("input_view", B_WILL_DRAW | B_FOLLOW_ALL); - _inputField->SetText("What is the matrix... printer ?"); + _inputField->SetText("What is the matrix... printer, Neo ?"); _inputField->MakeEditable(true); _inputField->MakeSelectable(true); _inputField->SetWordWrap(true); @@ -90,6 +90,7 @@ MainWindow::MainWindow() _sendButton->MakeDefault(true); + _answerView = new BTextView("answer", B_WILL_DRAW | B_FOLLOW_ALL); _answerView->MakeEditable(false); // Disable editing _answerView->MakeSelectable(true); // Enable text selection @@ -430,14 +431,23 @@ BMenuBar *MainWindow::_BuildMenu() { //------------------------- - menu = new BMenu(B_TRANSLATE("History")); + menu = new BMenu(B_TRANSLATE("Conversation")); + + item = new BMenuItem(B_TRANSLATE("Send Prompt" B_UTF8_ELLIPSIS), + new BMessage(kSendPrompt)); + item->SetShortcut('S', B_COMMAND_KEY); + item->SetTarget(this); + menu->AddItem(item); item = new BMenuItem(B_TRANSLATE("Clear History" B_UTF8_ELLIPSIS), new BMessage(kClearHistory)); item->SetTarget(this); + item->SetShortcut('K', B_COMMAND_KEY | B_SHIFT_KEY); + menu->AddItem(item); menuBar->AddItem(menu); + return menuBar; } diff --git a/MainWindow.h b/MainWindow.h index 97d419e..594a412 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -38,15 +38,12 @@ public: // Overriding FrameResized to receive notifications on resize void FrameResized(float newWidth, float newHeight) override { printf("Window resized to: Width = %f, Height = %f\n", newWidth, newHeight); - // You can add additional handling code here if needed - // Resize the scroll view if necessary, otherwise we lose scroll ability - - - } + + Conversation *_conversation = new Conversation(this); void checkValidKey();