-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchat.h
More file actions
44 lines (35 loc) · 1.12 KB
/
Copy pathchat.h
File metadata and controls
44 lines (35 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include <GLFW/glfw3.h>
#include <vector>
#include "listbox.h"
#include "markdown_utils.h"
#include "textedit.h"
#include "widget.h"
struct Segment {
bool isCode; // true ⇒ this segment is a code block
std::string content; // the raw text of that segment
std::vector<MarkdownSpan> spans;
};
class Chat : public Widget {
public:
Chat(Widget* parent);
bool rounded = true;
void render();
void position(int x, int y, int width, int height);
bool on_mouse_button_event(int button, int action, int mods);
bool on_scroll_event(double xchange, double ychange);
bool on_key_event(int key, int scancode, int action, int mods);
double scrolled_to = 0;
int min_scroll = 0;
private:
TextEdit* querybox = nullptr;
std::vector<Widget*> message_te = {};
std::vector<bool> from_user = {};
Button* filesButton;
std::vector<std::string> textstoadd = {};
ListBox* filesAddList;
Button* newChat;
bool running = false;
const std::string SYSTEM_PROMPT = "You are an AI model, running inside of the CodeWizard code editor created by Adam Mather.";
std::vector<Segment> splitMarkdown(const std::string& input);
};