Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
chat-flow.md229 linesDownload Raw Back to flows
1```mermaid2sequenceDiagram3    participant UI as 🧩 ChatForm / ChatMessage4    participant chatStore as 🗄️ chatStore5    participant agenticStore as 🗄️ agenticStore6    participant convStore as 🗄️ conversationsStore7    participant settingsStore as 🗄️ settingsStore8    participant mcpStore as 🗄️ mcpStore9    participant ChatSvc as ⚙️ ChatService10    participant DbSvc as ⚙️ DatabaseService11    participant API as 🌐 /v1/chat/completions12 13    Note over chatStore: State:<br/>isLoading, currentResponse<br/>errorDialogState, activeProcessingState<br/>chatLoadingStates (Map)<br/>chatStreamingStates (Map)<br/>abortControllers (Map)<br/>processingStates (Map)14 15    %% ═══════════════════════════════════════════════════════════════════════════16    Note over UI,API: 💬 SEND MESSAGE17    %% ═══════════════════════════════════════════════════════════════════════════18 19    UI->>chatStore: sendMessage(content, extras)20    activate chatStore21 22    chatStore->>chatStore: setChatLoading(convId, true)23    chatStore->>chatStore: clearChatStreaming(convId)24 25    alt no active conversation26        chatStore->>convStore: createConversation()27        Note over convStore: → see conversations-flow.mmd28    end29 30    chatStore->>mcpStore: consumeResourceAttachmentsAsExtras()31    Note right of mcpStore: Converts pending MCP resource<br/>attachments into message extras32 33    chatStore->>chatStore: addMessage("user", content, extras)34    chatStore->>DbSvc: createMessageBranch(userMsg, parentId)35    chatStore->>convStore: addMessageToActive(userMsg)36    chatStore->>convStore: updateCurrentNode(userMsg.id)37 38    chatStore->>chatStore: createAssistantMessage(userMsg.id)39    chatStore->>DbSvc: createMessageBranch(assistantMsg, userMsg.id)40    chatStore->>convStore: addMessageToActive(assistantMsg)41 42    chatStore->>chatStore: streamChatCompletion(messages, assistantMsg)43    deactivate chatStore44 45    %% ═══════════════════════════════════════════════════════════════════════════46    Note over UI,API: 🌊 STREAMING (with agentic flow detection)47    %% ═══════════════════════════════════════════════════════════════════════════48 49    activate chatStore50    chatStore->>chatStore: startStreaming()51    Note right of chatStore: isStreamingActive = true52 53    chatStore->>chatStore: setActiveProcessingConversation(convId)54    chatStore->>chatStore: getOrCreateAbortController(convId)55    Note right of chatStore: abortControllers.set(convId, new AbortController())56 57    chatStore->>chatStore: getApiOptions()58    Note right of chatStore: Merge from settingsStore.config:<br/>temperature, max_tokens, top_p, etc.59 60    alt agenticConfig.enabled && mcpStore has connected servers61        chatStore->>agenticStore: runAgenticFlow(convId, messages, assistantMsg, options, signal)62        Note over agenticStore: Multi-turn agentic loop:<br/>1. Call ChatService.sendMessage()<br/>2. If response has tool_calls → execute via mcpStore<br/>3. Append tool results as messages<br/>4. Loop until no more tool_calls or maxTurns<br/>→ see agentic flow details below63        agenticStore-->>chatStore: final response with timings64    else standard (non-agentic) flow65        chatStore->>ChatSvc: sendMessage(messages, options, signal)66    end67 68    activate ChatSvc69 70    ChatSvc->>ChatSvc: convertDbMessageToApiChatMessageData(messages)71    Note right of ChatSvc: DatabaseMessage[] → ApiChatMessageData[]<br/>Process attachments (images, PDFs, audio)72 73    ChatSvc->>API: POST /v1/chat/completions74    Note right of API: {messages, model?, stream: true, ...params}75 76    loop SSE chunks77        API-->>ChatSvc: data: {"choices":[{"delta":{...}}]}78        ChatSvc->>ChatSvc: handleStreamResponse(response)79 80        alt content chunk81            ChatSvc-->>chatStore: onChunk(content)82            chatStore->>chatStore: setChatStreaming(convId, response, msgId)83            Note right of chatStore: currentResponse = $state(accumulated)84            chatStore->>convStore: updateMessageAtIndex(idx, {content})85        end86 87        alt reasoning chunk88            ChatSvc-->>chatStore: onReasoningChunk(reasoning)89            chatStore->>convStore: updateMessageAtIndex(idx, {thinking})90        end91 92        alt tool_calls chunk93            ChatSvc-->>chatStore: onToolCallChunk(toolCalls)94            chatStore->>convStore: updateMessageAtIndex(idx, {toolCalls})95        end96 97        alt model info98            ChatSvc-->>chatStore: onModel(modelName)99            chatStore->>chatStore: recordModel(modelName)100            chatStore->>DbSvc: updateMessage(msgId, {model})101        end102 103        alt timings (during stream)104            ChatSvc-->>chatStore: onTimings(timings, promptProgress)105            chatStore->>chatStore: updateProcessingStateFromTimings()106        end107 108        chatStore-->>UI: reactive $state update109    end110 111    API-->>ChatSvc: data: [DONE]112    ChatSvc-->>chatStore: onComplete(content, reasoning, timings, toolCalls)113    deactivate ChatSvc114 115    chatStore->>chatStore: stopStreaming()116    chatStore->>DbSvc: updateMessage(msgId, {content, timings, model})117    chatStore->>convStore: updateCurrentNode(msgId)118    chatStore->>chatStore: setChatLoading(convId, false)119    chatStore->>chatStore: clearChatStreaming(convId)120    chatStore->>chatStore: clearProcessingState(convId)121    deactivate chatStore122 123    %% ═══════════════════════════════════════════════════════════════════════════124    Note over UI,API: ⏹️ STOP GENERATION125    %% ═══════════════════════════════════════════════════════════════════════════126 127    UI->>chatStore: stopGeneration()128    activate chatStore129    chatStore->>chatStore: savePartialResponseIfNeeded(convId)130    Note right of chatStore: Save currentResponse to DB if non-empty131    chatStore->>chatStore: abortControllers.get(convId).abort()132    Note right of chatStore: fetch throws AbortError → caught by isAbortError()133    chatStore->>chatStore: stopStreaming()134    chatStore->>chatStore: setChatLoading(convId, false)135    chatStore->>chatStore: clearChatStreaming(convId)136    chatStore->>chatStore: clearProcessingState(convId)137    deactivate chatStore138 139    %% ═══════════════════════════════════════════════════════════════════════════140    Note over UI,API: 🔁 REGENERATE141    %% ═══════════════════════════════════════════════════════════════════════════142 143    UI->>chatStore: regenerateMessageWithBranching(msgId, model?)144    activate chatStore145    chatStore->>convStore: findMessageIndex(msgId)146    chatStore->>chatStore: Get parent of target message147    chatStore->>chatStore: createAssistantMessage(parentId)148    chatStore->>DbSvc: createMessageBranch(newAssistantMsg, parentId)149    chatStore->>convStore: refreshActiveMessages()150    Note right of chatStore: Same streaming flow151    chatStore->>chatStore: streamChatCompletion(...)152    deactivate chatStore153 154    %% ═══════════════════════════════════════════════════════════════════════════155    Note over UI,API: ➡️ CONTINUE156    %% ═══════════════════════════════════════════════════════════════════════════157 158    UI->>chatStore: continueAssistantMessage(msgId)159    activate chatStore160    chatStore->>chatStore: Get existing content from message161    chatStore->>chatStore: streamChatCompletion(..., existingContent)162    Note right of chatStore: Appends to existing message content163    deactivate chatStore164 165    %% ═══════════════════════════════════════════════════════════════════════════166    Note over UI,API: ✏️ EDIT USER MESSAGE167    %% ═══════════════════════════════════════════════════════════════════════════168 169    UI->>chatStore: editMessageWithBranching(msgId, newContent, extras)170    activate chatStore171    chatStore->>chatStore: Get parent of target message172    chatStore->>DbSvc: createMessageBranch(editedMsg, parentId)173    chatStore->>convStore: refreshActiveMessages()174    Note right of chatStore: Creates new branch, original preserved175    chatStore->>chatStore: createAssistantMessage(editedMsg.id)176    chatStore->>chatStore: streamChatCompletion(...)177    Note right of chatStore: Automatically regenerates response178    deactivate chatStore179 180    %% ═══════════════════════════════════════════════════════════════════════════181    Note over UI,API: ❌ ERROR HANDLING182    %% ═══════════════════════════════════════════════════════════════════════════183 184    Note over chatStore: On stream error (non-abort):185    chatStore->>chatStore: showErrorDialog(type, message)186    Note right of chatStore: errorDialogState = {type: 'timeout'|'server', message}187    chatStore->>convStore: removeMessageAtIndex(failedMsgIdx)188    chatStore->>DbSvc: deleteMessage(failedMsgId)189 190    %% ═══════════════════════════════════════════════════════════════════════════191    Note over UI,API: 🤖 AGENTIC LOOP (when agenticConfig.enabled)192    %% ═══════════════════════════════════════════════════════════════════════════193 194    Note over agenticStore: agenticStore.runAgenticFlow(convId, messages, assistantMsg, options, signal)195    activate agenticStore196    agenticStore->>agenticStore: getSession(convId) or create new197    agenticStore->>agenticStore: updateSession(turn: 0, running: true)198 199    loop executeAgenticLoop (until no tool_calls or maxTurns)200        agenticStore->>agenticStore: turn++201        agenticStore->>ChatSvc: sendMessage(messages, options, signal)202        ChatSvc->>API: POST /v1/chat/completions203        API-->>ChatSvc: response with potential tool_calls204        ChatSvc-->>agenticStore: onComplete(content, reasoning, timings, toolCalls)205 206        alt response has tool_calls207            agenticStore->>agenticStore: normalizeToolCalls(toolCalls)208            loop for each tool_call209                agenticStore->>agenticStore: updateSession(streamingToolCall)210                agenticStore->>mcpStore: executeTool(mcpCall, signal)211                mcpStore-->>agenticStore: tool result212                agenticStore->>agenticStore: extractBase64Attachments(result)213                agenticStore->>agenticStore: emitToolCallResult(convId, ...)214                agenticStore->>convStore: addMessageToActive(toolResultMsg)215                agenticStore->>DbSvc: createMessageBranch(toolResultMsg)216            end217            agenticStore->>agenticStore: Create new assistantMsg for next turn218            Note right of agenticStore: Continue loop with updated messages219        else no tool_calls (final response)220            agenticStore->>agenticStore: buildFinalTimings(allTurns)221            Note right of agenticStore: Break loop, return final response222        end223    end224 225    agenticStore->>agenticStore: updateSession(running: false)226    agenticStore-->>chatStore: final content, timings, model227    deactivate agenticStore228```229 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai