Added ANSWER programmatic info
This commit is contained in:
parent
ddd024cc4a
commit
b32f0948c4
@ -262,6 +262,13 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
|||||||
try {
|
try {
|
||||||
apiClient.sendMessageStream(chatMessage, {
|
apiClient.sendMessageStream(chatMessage, {
|
||||||
onMessage: (msg: ChatMessage): void => {
|
onMessage: (msg: ChatMessage): void => {
|
||||||
|
if (msg.content.match(/^ANSWER:\s*/)) {
|
||||||
|
msg.content = msg.content.replace(/^ANSWER:\s*/, '');
|
||||||
|
msg.extraContext = {
|
||||||
|
isAnswer: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
setMessages(prev => {
|
setMessages(prev => {
|
||||||
const filtered = prev.filter(m => m.id !== msg.id);
|
const filtered = prev.filter(m => m.id !== msg.id);
|
||||||
return [...filtered, msg] as ChatMessage[];
|
return [...filtered, msg] as ChatMessage[];
|
||||||
@ -285,6 +292,9 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
|||||||
},
|
},
|
||||||
onStreaming: (chunk: ChatMessageStreaming): void => {
|
onStreaming: (chunk: ChatMessageStreaming): void => {
|
||||||
// console.log("onStreaming:", chunk);
|
// console.log("onStreaming:", chunk);
|
||||||
|
if (chunk.content[0] === 'A') {
|
||||||
|
chunk.content = chunk.content.replace(/A[^:]*:?/, '');
|
||||||
|
}
|
||||||
setStreamingMessage({
|
setStreamingMessage({
|
||||||
...chunk,
|
...chunk,
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
@ -341,6 +351,15 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
|||||||
try {
|
try {
|
||||||
const result = await apiClient.getChatMessages(chatSession.id);
|
const result = await apiClient.getChatMessages(chatSession.id);
|
||||||
const chatMessages: ChatMessage[] = result.data;
|
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);
|
setMessages(chatMessages);
|
||||||
setProcessingMessage(null);
|
setProcessingMessage(null);
|
||||||
setStreamingMessage(null);
|
setStreamingMessage(null);
|
||||||
@ -410,6 +429,10 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{message.role === 'assistant' && (
|
{message.role === 'assistant' && (
|
||||||
|
<>
|
||||||
|
{message.extraContext?.isAnswer ? (
|
||||||
|
<StyledMarkdown content={message.content} />
|
||||||
|
) : (
|
||||||
<EditViewer
|
<EditViewer
|
||||||
original={resume}
|
original={resume}
|
||||||
content={message.content}
|
content={message.content}
|
||||||
@ -419,6 +442,8 @@ const ResumeChat = forwardRef<ConversationHandle, ResumeChatProps>(
|
|||||||
sx={{ maxWidth: '100%', boxSizing: 'border-box' }}
|
sx={{ maxWidth: '100%', boxSizing: 'border-box' }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
{processingMessage !== null && (
|
{processingMessage !== null && (
|
||||||
|
@ -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 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
|
- 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:**
|
**Guidelines:**
|
||||||
- You are provided the current resume content in the <resume> section
|
- You are provided the current resume content in the <resume> section
|
||||||
- Only make edits that are requested by the user
|
- 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 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)
|
- 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.
|
If the user did not ask a question, return the entire resume with the requested edits applied while maintaining the current formatting.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger.info(
|
logger.info(f"Generating edit_resume response to: {prompt}\ncontext: {extra_context}")
|
||||||
f"Generating resume edits for session {session_id} with prompt: {prompt} and context: {extra_context} and tunables: {tunables}"
|
|
||||||
)
|
|
||||||
async for message in self.edit_resume(
|
async for message in self.edit_resume(
|
||||||
llm=llm,
|
llm=llm,
|
||||||
model=model,
|
model=model,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user