Skip to content

Commit 446b92d

Browse files
updated user prompt
1 parent cb414c8 commit 446b92d

2 files changed

Lines changed: 23 additions & 19 deletions

File tree

app.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -882,10 +882,18 @@ async def generate_title(conversation_messages):
882882

883883

884884
async def get_section_content(request_body, request_headers):
885-
prompt = f"""{app_settings.azure_openai.generate_section_content_prompt}
886-
Section Title: {request_body['sectionTitle']}
887-
Section Description: {request_body['sectionDescription']}
888-
"""
885+
prompt = f'''Generate content for the sections below: { request_body }.
886+
For eacth section, use the SectionTitle and SectionDescription to
887+
create a new attributed called 'content' that contains the generated content,
888+
Do not include any other commentary or description.
889+
Always format the sections for better readability.
890+
Leave placeholders for names and amounts etc.
891+
Do not use markdown syntax.
892+
'''
893+
# prompt = f"""{app_settings.azure_openai.generate_section_content_prompt}
894+
# Section Title: {request_body['sectionTitle']}
895+
# Section Description: {request_body['sectionDescription']}
896+
# """
889897

890898
messages = [{"role": "system", "content": app_settings.azure_openai.system_message}]
891899
messages.append({"role": "user", "content": prompt})
@@ -895,12 +903,8 @@ async def get_section_content(request_body, request_headers):
895903

896904
try:
897905
azure_openai_client = init_openai_client()
898-
raw_response = (
899-
await azure_openai_client.chat.completions.with_raw_response.create(
900-
**model_args
901-
)
902-
)
903-
response = raw_response.parse()
906+
response = await azure_openai_client.chat.completions.create(**model_args)
907+
# response = raw_response.parse()
904908

905909
except Exception as e:
906910
logging.exception("Exception in send_chat_request")

frontend/src/api/api.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,12 @@ export const historyMessageFeedback = async (messageId: string, feedback: string
373373

374374
export const sectionGenerate = async (options: SectionGenerateRequest): Promise<Response> => {
375375
// set timeout to 10 seconds
376-
const abortController = new AbortController()
377-
const abortSignal = abortController.signal
376+
// const abortController = new AbortController()
377+
// const abortSignal = abortController.signal
378378

379-
const timeout = setTimeout(() => {
380-
abortController.abort()
381-
}, 10000)
379+
// const timeout = setTimeout(() => {
380+
// abortController.abort()
381+
// }, 30000)
382382

383383
let body = JSON.stringify({
384384
sectionTitle: options.sectionTitle,
@@ -390,15 +390,15 @@ export const sectionGenerate = async (options: SectionGenerateRequest): Promise<
390390
headers: {
391391
'Content-Type': 'application/json'
392392
},
393-
body: body,
394-
signal: abortSignal
393+
body: body
394+
// signal: abortSignal
395395
})
396396
.then(res => {
397-
clearTimeout(timeout)
397+
// clearTimeout(timeout)
398398
return res
399399
})
400400
.catch(_err => {
401-
clearTimeout(timeout)
401+
// clearTimeout(timeout)
402402
console.error('There was an issue fetching your data.')
403403
return new Response(
404404
JSON.stringify({ section_content: 'There was an issue fetching your data. Please try again.' })

0 commit comments

Comments
 (0)