Save AI messages to PostgreSQL alongside Redis
Proposal
This issue is to achieve the following tasks for Switch to PostgreSQL from Redis in ChatStorage (&15713 - closed).
- Add the storage abstraction
Gitlab::Llm::ChatStorage::Postgresql,Gitlab::Llm::ChatStorage::RedisandGitlab::Llm::ChatStorage::Base. - Starts saving AI message (i.e.
Gitlab::Llm::ChatMessage.save!) to PostgreSQL alongside saving to Redis. We still read messages from Redis.- We should also update the
last_message_updated_atcolumn ofthreadstable. e.g.current_thread.touch(:last_message_updated_at).
- We should also update the
- Add
duo_chat_storage_postgresqlfeature flag. - When the
duo_chat_storage_postgresqlis enabled, the messages are read from PostgreSQL instead of Redis.
PoC
See PoC MR PoC: Duo Chat Storage with PostgreSQL (Not For ... (!170230 - closed).
Edited by Shinya Maeda