stage compare source code comment

This commit is contained in:
binary-husky
2024-07-13 15:28:53 +00:00
parent 8747c48175
commit c1b8c773c3
5 changed files with 82 additions and 6 deletions

View File

@@ -118,6 +118,7 @@ def zip_result(folder):
class PythonCodeComment():
def __init__(self, llm_kwargs, language) -> None:
self.original_content = ""
self.full_context = []
self.full_context_with_line_no = []
self.current_page_start = 0
@@ -140,6 +141,7 @@ class PythonCodeComment():
def read_file(self, path, brief):
with open(path, 'r', encoding='utf8') as f:
self.full_context = f.readlines()
self.original_content = ''.join(self.full_context)
self.file_basename = os.path.basename(path)
self.file_brief = brief
self.full_context_with_line_no = self.generate_tagged_code_from_full_context()

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>源文件对比</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
display: flex;
width: 80%;
}
.code-container {
flex: 1;
margin: 3px;
padding: 3px;
border: 1px solid #ccc;
background-color: #f9f9f9;
overflow: auto;
}
pre {
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
</head>
<body>
<div class="container">
<div class="code-container">
<pre>
REPLACE_CODE_FILE_LEFT
</pre>
</div>
<div class="code-container">
<pre>
REPLACE_CODE_FILE_RIGHT
</pre>
</div>
</div>
</body>
</html>