Merge pull request #672 from Keldos-Li/fixHTML
fix: specify encoding when saving HTML
This commit is contained in:
		
						commit
						79cd98fc24
					
				@ -13,7 +13,7 @@ def write_chat_to_file(chatbot, history=None, file_name=None):
 | 
				
			|||||||
    os.makedirs('./gpt_log/', exist_ok=True)
 | 
					    os.makedirs('./gpt_log/', exist_ok=True)
 | 
				
			||||||
    with open(f'./gpt_log/{file_name}', 'w', encoding='utf8') as f:
 | 
					    with open(f'./gpt_log/{file_name}', 'w', encoding='utf8') as f:
 | 
				
			||||||
        from theme import advanced_css
 | 
					        from theme import advanced_css
 | 
				
			||||||
        f.write(f'<head><title>对话历史</title><style>{advanced_css}</style></head>')
 | 
					        f.write(f'<!DOCTYPE html><head><meta charset="utf-8"><title>对话历史</title><style>{advanced_css}</style></head>')
 | 
				
			||||||
        for i, contents in enumerate(chatbot):
 | 
					        for i, contents in enumerate(chatbot):
 | 
				
			||||||
            for j, content in enumerate(contents):
 | 
					            for j, content in enumerate(contents):
 | 
				
			||||||
                try:    # 这个bug没找到触发条件,暂时先这样顶一下
 | 
					                try:    # 这个bug没找到触发条件,暂时先这样顶一下
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user