Commit Graph

8851 Commits

Author SHA1 Message Date
Bartosz Taudul
8b100ff11d Use custom tool handling.
The ollama tool_calls do not preserve the context of why the tool was
called. The feature as it is right now doesn't seem to be designed for
the LLM to make queries, but rather to act as an agent that is supposed
to call some functions that will directly provide their output to the
user.

Instead, let's encode the tool calling protocol in the system prompt.
2025-07-12 11:50:00 +02:00
Bartosz Taudul
0d3e183540 Display tool responses in chat. 2025-07-12 11:49:59 +02:00
Bartosz Taudul
05f7019f30 Chat will have system prompt. 2025-07-12 11:49:59 +02:00
Bartosz Taudul
2e61fbac78 Expand system prompt. 2025-07-12 11:49:59 +02:00
Bartosz Taudul
4ad9e05814 Convert html to markdown. 2025-07-12 11:49:59 +02:00
Bartosz Taudul
f5ea5ffce1 Display tool call arguments. 2025-07-12 11:49:59 +02:00
Bartosz Taudul
dc8c106454 Implement fetching web pages. 2025-07-12 11:49:59 +02:00
Bartosz Taudul
3a60926f65 Link with libcurl. 2025-07-12 11:49:59 +02:00
Bartosz Taudul
9202ce277d Respond to tool calls. 2025-07-12 11:49:59 +02:00
Bartosz Taudul
b4763c7500 Pass messages to SendMessage() as const ref, not rvalue. 2025-07-12 11:49:58 +02:00
Bartosz Taudul
78257553c7 Allow disabling tools use. 2025-07-12 11:49:58 +02:00
Bartosz Taudul
4c46cc4deb Push available tools list to ollama. 2025-07-12 11:49:58 +02:00
Bartosz Taudul
7eedbe130e Prepare ollama request in an explicit way. 2025-07-12 11:49:58 +02:00
Bartosz Taudul
3414773f18 Keep system prompt unembedded. 2025-07-12 11:49:58 +02:00
Bartosz Taudul
c8dbe33a3c Move LLM system prompt to an external file. 2025-07-12 11:49:58 +02:00
Bartosz Taudul
cc0aa73527 Add embed utilities. 2025-07-12 11:49:58 +02:00
Bartosz Taudul
8006ae9e30 Build embed tool. 2025-07-12 11:49:58 +02:00
Bartosz Taudul
8fd1530c8f Rework context size handling.
The user now specifies max context size to be used for all models.
2025-07-12 11:49:57 +02:00
Bartosz Taudul
74b6e481bb Add spacing between chat messages. 2025-07-12 11:49:57 +02:00
Bartosz Taudul
10decca063 Fix chat input focus. 2025-07-12 11:49:57 +02:00
Bartosz Taudul
b901544fb4 Draw ellipsis when waiting for ollama reply (loading model, parsing prompt, etc.) 2025-07-12 11:49:57 +02:00
Bartosz Taudul
1590d3196b Don't wait for streaming to end when exiting. 2025-07-12 11:49:57 +02:00
Bartosz Taudul
dedc9259c1 Add basic system prompt. 2025-07-12 11:49:57 +02:00
Bartosz Taudul
e8578668d4 Add support for basic markdown features. 2025-07-12 11:49:57 +02:00
Bartosz Taudul
2bf627061e Add support for printing code blocks. 2025-07-12 11:49:57 +02:00
Bartosz Taudul
b982515774 Use string references instead of copies. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
60230c2d7e Split chat responses into lines for easier parsing. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
cfd3260ea0 Count chat lines. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
3a60a67c95 Explicitly check for assistant role. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
2ad2fa0b4a Get role string only once. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
1ebe85d24f Always show scroll bar in chat window. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
ef230b08f3 Don't display the "thinking" unless asked for. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
b90e0fa467 Adjust colors. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
18a220d4db Support displaying ollama error messages. 2025-07-12 11:49:56 +02:00
Bartosz Taudul
22d139bff7 Allow changing context size. 2025-07-12 11:49:55 +02:00
Bartosz Taudul
c36386ac81 Scroll to bottom when chat is updating. 2025-07-12 11:49:55 +02:00
Bartosz Taudul
8edbdc8081 Add icons to help differentiate user from bot answers. 2025-07-12 11:49:55 +02:00
Bartosz Taudul
d499458c69 Working chat. 2025-07-12 11:49:55 +02:00
Bartosz Taudul
a25b189692 Put a date on the Weizenbaum quote. 2025-07-12 11:49:55 +02:00
Bartosz Taudul
dc325dae89 Focus chat entry field when LLM UI is opened. 2025-07-12 11:49:55 +02:00
Bartosz Taudul
58125770b1 Use ollama::messages instead of vector of strings to hold chat messages.
The implementation is similar, but this way is needed for the ollama-hpp
API.
2025-07-12 11:49:55 +02:00
Bartosz Taudul
c1998bd9f3 Basic chat input and rendering. 2025-07-12 11:49:55 +02:00
Bartosz Taudul
2ea7a183f1 Add chat UI elements. 2025-07-12 11:49:54 +02:00
Bartosz Taudul
4250fa51c2 Add model selection to LLM UI. 2025-07-12 11:49:54 +02:00
Bartosz Taudul
571189c9da Use the intended icon for setting default ollama url. 2025-07-12 11:49:54 +02:00
Bartosz Taudul
42010dc457 Handle no connection / busy cases in LLM UI. 2025-07-12 11:49:54 +02:00
Bartosz Taudul
ab76bafdf7 Use three dots to indicate background tasks instead of one pulsing dot. 2025-07-12 11:49:54 +02:00
Bartosz Taudul
3a4786d2be httplib may throw on invalid protocol. 2025-07-12 11:49:54 +02:00
Bartosz Taudul
4c7338ec1e Load LLM models in a thread. 2025-07-12 11:49:54 +02:00
Bartosz Taudul
fd291f225e Properly set state when reseting ollama URL to default. 2025-07-12 11:49:54 +02:00