Skip to content

Commit

Permalink
Refactor PromptService to improve readability and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
oslaman committed May 12, 2024
1 parent 271d57b commit 76c30cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions backend/chatsql/application/PromptService.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def query(self, question: str, filename: str) -> str:

file_content = JSONRepositoryAdapter.open(filename)
tables = file_content['tables_info']
presult = " "
presult = "\n"
#result = list(set([e.table_name for e in context]))

for table_name, similarity in context:
Expand All @@ -68,9 +68,7 @@ def query(self, question: str, filename: str) -> str:
presult = presult +"\n\n"
#print(presult)

return f"""Act as a SQL engineer.\n Given the context below, generate a query for MariaDB to answer the following question: {question}. \n
{presult}
"""
return f"""Act as a SQL engineer.\nGiven the context below, generate a query for MariaDB to answer the following question: {question}.\n{presult}"""

def load(self, filename: str) -> List[Embedding]:
if filename == None:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ViewGeneratedPrompts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class="w-100 p-3 text-black bg-light border-start border-end">
<i class="bi bi-robot me-2"></i>
<strong>Response</strong>
<p>{{ message.text }}</p>
<pre>{{ message.text }}</pre>
<i class="bi bi-clipboard me-2 copy-icon" @click="copyToClipboard(message.text)"
data-cy="copy-button" aria-label="Copia"></i>
</div>
Expand Down

0 comments on commit 76c30cd

Please sign in to comment.