Added ANSWER programmatic info
This commit is contained in:
parent
ddd024cc4a
commit
b32f0948c4
@ -262,6 +262,13 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
||||
try {
|
||||
apiClient.sendMessageStream(chatMessage, {
|
||||
onMessage: (msg: ChatMessage): void => {
|
||||
if (msg.content.match(/^ANSWER:\s*/)) {
|
||||
msg.content = msg.content.replace(/^ANSWER:\s*/, '');
|
||||
msg.extraContext = {
|
||||
isAnswer: true,
|
||||
};
|
||||
}
|
||||
|
||||
setMessages(prev => {
|
||||
const filtered = prev.filter(m => m.id !== msg.id);
|
||||
return [...filtered, msg] as ChatMessage[];
|
||||
@ -285,6 +292,9 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
||||
},
|
||||
onStreaming: (chunk: ChatMessageStreaming): void => {
|
||||
// console.log("onStreaming:", chunk);
|
||||
if (chunk.content[0] === 'A') {
|
||||
chunk.content = chunk.content.replace(/A[^:]*:?/, '');
|
||||
}
|
||||
setStreamingMessage({
|
||||
...chunk,
|
||||
role: 'assistant',
|
||||
@ -341,6 +351,15 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
||||
try {
|
||||
const result = await apiClient.getChatMessages(chatSession.id);
|
||||
const chatMessages: ChatMessage[] = result.data;
|
||||
chatMessages.forEach(msg => {
|
||||
if (msg.role === 'assistant' && msg.content.match(/^ANSWER:\s*/)) {
|
||||
msg.content = msg.content.replace(/^ANSWER:\s*/, '');
|
||||
msg.extraContext = {
|
||||
isAnswer: true,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
setMessages(chatMessages);
|
||||
setProcessingMessage(null);
|
||||
setStreamingMessage(null);
|
||||
@ -410,14 +429,20 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
||||
</>
|
||||
)}
|
||||
{message.role === 'assistant' && (
|
||||
<EditViewer
|
||||
original={resume}
|
||||
content={message.content}
|
||||
onUpdate={(content: string): void => {
|
||||
onResumeChange && onResumeChange(content);
|
||||
}}
|
||||
sx={{ maxWidth: '100%', boxSizing: 'border-box' }}
|
||||
/>
|
||||
<>
|
||||
{message.extraContext?.isAnswer ? (
|
||||
<StyledMarkdown content={message.content} />
|
||||
) : (
|
||||
<EditViewer
|
||||
original={resume}
|
||||
content={message.content}
|
||||
onUpdate={(content: string): void => {
|
||||
onResumeChange && onResumeChange(content);
|
||||
}}
|
||||
sx={{ maxWidth: '100%', boxSizing: 'border-box' }}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
))}
|
||||
|
@ -213,6 +213,14 @@ You are a professional copy editor. Your task is to edit and enhance the provide
|
||||
- DO NOT add quantitative claims like "increased by X%", "reduced by X hours", "saved $X", "improved by X%" unless these exact figures are provided
|
||||
- DO NOT estimate, approximate, or infer numerical data
|
||||
|
||||
**RESPONSE FORMAT RULES:**
|
||||
- IF the user asks a question (contains question words like "what", "how", "why", "when", "where", "which", "who" OR ends with "?"), then:
|
||||
- Start response with exactly "ANSWER: " (including the space)
|
||||
- Provide only the answer, not the full resume
|
||||
- IF the user requests edits/changes to the resume, then:
|
||||
- Return the complete edited resume without any prefix
|
||||
- Do not include "ANSWER:" anywhere in the response
|
||||
|
||||
**Guidelines:**
|
||||
- You are provided the current resume content in the <resume> section
|
||||
- Only make edits that are requested by the user
|
||||
@ -227,14 +235,13 @@ You are a professional copy editor. Your task is to edit and enhance the provide
|
||||
- Example of ACCEPTABLE impact: "Streamlined resume analysis processes and reduced manual review requirements"
|
||||
- Example of UNACCEPTABLE impact: "Streamlined resume analysis processes with a 40% reduction in manual review time" (unless that 40% is stated in the original content)
|
||||
|
||||
If the user asks a question about the resume, provide a brief answer based only on the content of the resume or the context provided.
|
||||
If the user asks a question about the resume, state "ANSWER:" and then provide a brief answer based only on the content of the resume or the context provided.
|
||||
Start the response with "ANSWER:" if an answer is being rovided and not the full resume.
|
||||
|
||||
If the user did not ask a question, return the entire resume with the requested edits applied while maintaining the current formatting.
|
||||
"""
|
||||
|
||||
logger.info(
|
||||
f"Generating resume edits for session {session_id} with prompt: {prompt} and context: {extra_context} and tunables: {tunables}"
|
||||
)
|
||||
logger.info(f"Generating edit_resume response to: {prompt}\ncontext: {extra_context}")
|
||||
async for message in self.edit_resume(
|
||||
llm=llm,
|
||||
model=model,
|
||||
|
Loading…
x
Reference in New Issue
Block a user