Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support showing markdown image #462

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def prompt_template_render(self, prompt_template: dict):

CLAUDE_RAG_SYSTEM_PROMPT = """You are a customer service agent, and answering user's query. You ALWAYS follow these response rules when writing your response:
<response_rules>
- 如果<docs> </docs>里面的内容包含markdown格式的图片,如 ![image](https://www.demo.com/demo.png),请保留这个markdown格式的图片,并将他原封不动的输出到回答内容的最后,注意:不要修改这个markdown格式的图片.
- NERVER say "根据搜索结果/大家好/谢谢/根据这个文档...".
- 回答简单明了
- 如果问题与<docs> </docs>里面的内容不相关,直接回答 "根据内部知识库,找不到相关内容。"
Expand Down
10 changes: 5 additions & 5 deletions source/portal/src/pages/chatbot/ChatBot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ const ChatBot: React.FC<ChatBotProps> = (props: ChatBotProps) => {
sessionMessage.map((msg) => {
let messageContent = msg.content;
// Handle AI images message
// if (msg.role === 'ai' && msg.additional_kwargs?.figure?.length > 0) {
// msg.additional_kwargs.figure.forEach((item) => {
// messageContent += ` \n ![${item.content_type}](/${encodeURIComponent(item.figure_path)})`;
// });
// }
if (msg.role === 'ai' && msg.additional_kwargs?.figure?.length > 0) {
msg.additional_kwargs.figure.forEach((item) => {
messageContent += ` \n ![${item.content_type}](/${encodeURIComponent(item.figure_path)})`;
});
}
return {
type: msg.role,
message: {
Expand Down
Loading