Arbazkhan-cs commited on
Commit
8b5ed6e
1 Parent(s): 5fcf163

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -5,6 +5,7 @@ from utils import create_retriever_tool_agent, create_arxiv_tool_agent, google_s
5
  from langchain_groq import ChatGroq
6
  from langchain.agents import create_tool_calling_agent, AgentExecutor
7
  from dotenv import load_dotenv
 
8
 
9
  load_dotenv()
10
 
@@ -52,11 +53,9 @@ def index():
52
  if 'query' in request.form:
53
  query = request.form['query']
54
  result = app.config["agent_executor"].invoke({"input": query})["output"]
55
- max_line_length = 100
56
- text = result
57
- lines = [text[i:i+max_line_length] for i in range(0, len(text), max_line_length)]
58
- formatted_text = "\n".join(lines)
59
- return render_template('index.html', result=formatted_text)
60
 
61
  return render_template('index.html')
62
 
 
5
  from langchain_groq import ChatGroq
6
  from langchain.agents import create_tool_calling_agent, AgentExecutor
7
  from dotenv import load_dotenv
8
+ import textwrap
9
 
10
  load_dotenv()
11
 
 
53
  if 'query' in request.form:
54
  query = request.form['query']
55
  result = app.config["agent_executor"].invoke({"input": query})["output"]
56
+
57
+ wrapped_result = textwrap.wrap(result, width=120)
58
+ return render_template('index.html', result=wrapped_result)
 
 
59
 
60
  return render_template('index.html')
61