postgres_sql_client module

class postgres_sql_client.PostgreSQLClient(POSTGRES_HOST, POSTGRES_DB, POSTGRES_USERNAME, POSTGRES_PASSWORD, POSTGRES_PORT, POSTGRES_TABLE_CONVERSATIONS, POSTGRES_TABLE_REPORTS)

Bases: object

get_messages(chat_id)

This method retrieve al messages of a chat

Chat_id:

the chat_id from telegram

Returns:

List of tuples containing all messages of a conversation

Return type:

List

insert_message(chat_id, role, content)

This method insert a message into the conversations table

Chat_id:

the chat_id from telegram

Role:

who is writing the message

Content:

the content of the message itself

Returns:

nothing

Return type:

None

insert_report(chat_id, content, severity)

This method lets you save on the db a report of a conversation

Chat_id:

the chat_id from telegram

Content:

the summary of the conversation

Severity:

the grade of dangerousness of the conversation

Returns:

nothing

Return type:

None