feat: pictures for the assistant - the models make and edit them by themselves through the Vertex API (a new picture, or the user's attached photo, or the last picture made), with an API key in Настройки and a switch for the prompt improver; folded descriptions of pictures and searches; the name of an attached file opens or saves it; a deleted chat is wiped from the database files, attachments included
This commit is contained in:
1 parent
c72fcfebf3
commit
dd1244a169
13 files changed
+925
-20
No files matched your search
+13
-1
@@ -20,7 +20,7 @@ type DB struct {
|
||||
func OpenDB(path string) (*DB, error) {
|
||||
// _pragma busy_timeout avoids "database is locked" under the concurrent
|
||||
// long-poll load; foreign_keys keeps the schema honest.
|
||||
dsn := fmt.Sprintf("file:%s?_pragma=busy_timeout(5000)&_pragma=foreign_keys(1)&_pragma=journal_mode(WAL)", path)
|
||||
dsn := fmt.Sprintf("file:%s?_pragma=busy_timeout(5000)&_pragma=foreign_keys(1)&_pragma=journal_mode(WAL)&_pragma=secure_delete(1)", path)
|
||||
sdb, err := sql.Open("sqlite", dsn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -754,3 +754,15 @@ func boolInt(b bool) int {
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// wipeDeleted makes what was deleted leave the database's files: with
|
||||
// secure_delete the freed pages are overwritten, and the write-ahead log,
|
||||
// which still holds the rows as they were written, is emptied (SQLite only;
|
||||
// PostgreSQL cleans up for itself). The attachments of a chat deleted are
|
||||
// among that.
|
||||
func (db *DB) wipeDeleted() {
|
||||
if db.sql.pg {
|
||||
return
|
||||
}
|
||||
_, _ = db.sql.Exec(`PRAGMA wal_checkpoint(TRUNCATE)`)
|
||||
}
|
||||
Reference in new issue
Block a user