Skip to content

Commit 9b18e31

Browse files
authored
[DERCBOT-1365] Fix CSV headers (#1847)
1 parent 8754c0a commit 9b18e31

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

gen-ai/orchestrator-server/src/main/python/tock-llm-indexing-tools/smarttribune_consumer.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ async def _get_question(token, row, current_page):
9999
response_get_questions_json = await response.json()
100100
df_all_questions = pd.DataFrame(response_get_questions_json.get('data'))
101101
df_all_questions = df_all_questions.rename(
102-
columns={'title': 'Title', 'slug': 'URL'}
102+
columns={'title': 'title', 'slug': 'source'}
103103
)
104104
df_all_questions['knowledge_base_id'] = row.iloc[0]
105105
df_all_questions['channel_id'] = row.iloc[1]
106106
return df_all_questions.get(
107-
['knowledge_base_id', 'channel_id', 'documentId', 'Title', 'URL']
107+
['knowledge_base_id', 'channel_id', 'documentId', 'title', 'source']
108108
)
109109

110110

@@ -118,32 +118,32 @@ async def _get_answer(token, row):
118118
async with aiohttp.ClientSession(trust_env=True) as session:
119119
async with session.get(url, headers=headers) as response:
120120
if response.status != 200:
121-
row['Text'] = None
121+
row['text'] = None
122122
logging.error(await response.text(), response.status)
123123
return row.get(
124124
[
125125
'knowledge_base_id',
126126
'channel_id',
127127
'documentId',
128-
'Title',
129-
'URL',
130-
'Text',
128+
'title',
129+
'source',
130+
'text',
131131
]
132132
)
133133

134134
response_json = await response.json()
135135
if response_json.get('data'):
136-
row['Text'] = response_json.get('data')[0].get('content').get('body')
136+
row['text'] = response_json.get('data')[0].get('content').get('body')
137137
else:
138-
row['Text'] = None
138+
row['text'] = None
139139
return row.get(
140140
[
141141
'knowledge_base_id',
142142
'channel_id',
143143
'documentId',
144-
'Title',
145-
'URL',
146-
'Text',
144+
'title',
145+
'source',
146+
'text',
147147
]
148148
)
149149

@@ -276,12 +276,12 @@ async def _main(args, body_credentials):
276276
)
277277

278278
df_all_questions = pd.DataFrame(rawdata)
279-
print(df_all_questions.get('URL'))
279+
print(df_all_questions.get('source'))
280280
# format data
281281
logging.debug('format data')
282282
df_all_questions[
283-
'URL'
284-
] = f"{cli_args.get('<base_url>')}?question=" + df_all_questions.get('URL')
283+
'source'
284+
] = f"{cli_args.get('<base_url>')}?question=" + df_all_questions.get('source')
285285

286286
# export data
287287
logging.debug(f"Export to output CSV file {args.get('<output_csv>')}")

0 commit comments

Comments
 (0)