feat(logger): implement LLM debug logging functionality
- Added a new logger for LLM calls, enabling detailed logging of model interactions, including request and response data. - Introduced configuration options for enabling and specifying the log directory for LLM debug logs. - Implemented cleanup for old log files to manage disk space effectively. - Wrapped existing chat implementations to log calls when debug logging is enabled, enhancing traceability for model interactions.
This commit is contained in:
@@ -32,7 +32,12 @@ type KnowledgeTag struct {
|
||||
|
||||
// BeforeCreate ensures SeqID is populated for databases that don't support
|
||||
// autoIncrement on non-primary-key columns (e.g. SQLite).
|
||||
// On PostgreSQL/MySQL the DB sequence handles this, so we skip to avoid
|
||||
// duplicate key races under concurrent inserts.
|
||||
func (t *KnowledgeTag) BeforeCreate(tx *gorm.DB) error {
|
||||
if tx.Dialector.Name() != "sqlite" {
|
||||
return nil
|
||||
}
|
||||
if t.SeqID == 0 {
|
||||
var maxSeqID *int64
|
||||
tx.Unscoped().Model(&KnowledgeTag{}).
|
||||
|
||||
Reference in New Issue
Block a user