adjust db gen time
This commit is contained in:
parent
cdda2c840c
commit
dca2dc570f
|
@ -23,7 +23,7 @@ def init_db():
|
||||||
response TEXT,
|
response TEXT,
|
||||||
response_tokens INTEGER,
|
response_tokens INTEGER,
|
||||||
response_status INTEGER,
|
response_status INTEGER,
|
||||||
generation_time INTEGER,
|
generation_time FLOAT,
|
||||||
parameters TEXT CHECK (parameters IS NULL OR json_valid(parameters)),
|
parameters TEXT CHECK (parameters IS NULL OR json_valid(parameters)),
|
||||||
headers TEXT CHECK (headers IS NULL OR json_valid(headers)),
|
headers TEXT CHECK (headers IS NULL OR json_valid(headers)),
|
||||||
timestamp INTEGER
|
timestamp INTEGER
|
||||||
|
@ -55,7 +55,7 @@ def log_prompt(ip, token, prompt, response, gen_time, parameters, headers, backe
|
||||||
conn = sqlite3.connect(opts.database_path)
|
conn = sqlite3.connect(opts.database_path)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
c.execute("INSERT INTO prompts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
c.execute("INSERT INTO prompts VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
||||||
(ip, token, prompt, prompt_tokens, response, response_tokens, backend_response_code, gen_time, json.dumps(parameters), json.dumps(headers), timestamp))
|
(ip, token, prompt, prompt_tokens, response, response_tokens, backend_response_code, round(gen_time, 3), json.dumps(parameters), json.dumps(headers), timestamp))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
Reference in New Issue