compaction de contexte, filtre/pagination/suppression des conversations
- compaction automatique du contexte LLM quand la taille atteint le seuil (contexte max - taille de réponse max), par résumé de l'historique ancien - filtre textuel (?q=) et pagination (20/page) de l'historique des conversations - correctif ORM : offset de pagination en base 0 - suppression d'une conversation : messages associés supprimés, session en cours annulée, popup de confirmation (ConfirmDialog) - titres de conversation nettoyés du markdown - styles des listes markdown, variante danger du bouton - go.mod/go.sum : dépendances go-rod et stealth manquantes du commit précédent
This commit is contained in:
1 parent
a970bfa991
commit
51bbb45b32
86 files changed
+770
-113
No files matched your search
@@ -14,18 +14,20 @@ import (
|
||||
var systemSystemPrompt string
|
||||
|
||||
type ChatSession struct {
|
||||
userID string
|
||||
teamID string
|
||||
chatID string
|
||||
agent *domain.Agent
|
||||
provider *domain.Provider
|
||||
modelID string
|
||||
messages []*domain.Message
|
||||
llmEngine domain.LLMEngine
|
||||
toolService *tool.Service
|
||||
repoChat domain.ChatRepository
|
||||
subscribers []domain.StreamCallback
|
||||
mu sync.Mutex
|
||||
userID string
|
||||
teamID string
|
||||
chatID string
|
||||
agent *domain.Agent
|
||||
provider *domain.Provider
|
||||
modelID string
|
||||
messages []*domain.Message
|
||||
contextMaxTokens int
|
||||
maxResponseTokens int
|
||||
llmEngine domain.LLMEngine
|
||||
toolService *tool.Service
|
||||
repoChat domain.ChatRepository
|
||||
subscribers []domain.StreamCallback
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func (s *ChatSession) run(ctx context.Context) error {
|
||||
@@ -57,6 +59,11 @@ func (s *ChatSession) run(ctx context.Context) error {
|
||||
|
||||
// LOOP on TOOLS
|
||||
for continue_loop {
|
||||
// compaction du contexte : il doit rester assez de place pour la réponse
|
||||
if s.shouldCompact(systemPrompt.Content) {
|
||||
s.compactContext(ctx)
|
||||
}
|
||||
|
||||
msg := s.llmEngine.Stream(
|
||||
ctx,
|
||||
s.provider,
|
||||
|
||||
Reference in new issue
Block a user