Skip to content

Commit 3402391

Browse files
committed
fix: sync upstream
1 parent 92aaa43 commit 3402391

16 files changed

Lines changed: 90 additions & 16 deletions

File tree

.claude/settings.local.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"WebFetch(domain:docs.opengauss.org)",
5+
"WebSearch",
6+
"Bash(ls /d/projects/others/DocsGPT/application/vectorstore/*.py)",
7+
"Bash(xargs basename:*)",
8+
"Bash(netstat -ano)",
9+
"Bash(findstr \":5173\")",
10+
"Bash(netsh interface:*)",
11+
"Bash(findstr \"5173\")"
12+
]
13+
}
14+
}

application/agents/research_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939

4040
def _load_prompt(name: str) -> str:
41-
with open(os.path.join(_PROMPTS_DIR, name), "r") as f:
41+
with open(os.path.join(_PROMPTS_DIR, name), "r", encoding="utf-8") as f:
4242
return f.read()
4343

4444

application/alembic.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Alembic configuration for the DocsGPT user-data Postgres database.
22
#
3-
# The SQLAlchemy URL is deliberately NOT set here env.py reads it from
3+
# The SQLAlchemy URL is deliberately NOT set here - env.py reads it from
44
# ``application.core.settings.settings.POSTGRES_URI`` so the same config
55
# source serves the running app and migrations. To run from the project
66
# root::
@@ -12,7 +12,7 @@ script_location = %(here)s/alembic
1212
prepend_sys_path = ..
1313
version_path_separator = os
1414

15-
# sqlalchemy.url is intentionally left blank env.py supplies it.
15+
# sqlalchemy.url is intentionally left blank - env.py supplies it.
1616
sqlalchemy.url =
1717

1818
[post_write_hooks]

application/api/answer/services/compression/prompt_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _load_prompt(self, version: str) -> str:
3737
prompt_path = current_dir / "prompts" / "compression" / f"{version}.txt"
3838

3939
try:
40-
with open(prompt_path, "r") as f:
40+
with open(prompt_path, "r", encoding="utf-8") as f:
4141
return f.read()
4242
except FileNotFoundError:
4343
logger.error(f"Compression prompt template not found: {prompt_path}")

application/api/answer/services/stream_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def get_prompt(prompt_id: str, prompts_collection=None) -> str:
8383
if prompt_id in preset_mapping:
8484
file_path = os.path.join(prompts_dir, preset_mapping[prompt_id])
8585
try:
86-
with open(file_path, "r") as f:
86+
with open(file_path, "r", encoding="utf-8") as f:
8787
return f.read()
8888
except FileNotFoundError:
8989
raise FileNotFoundError(f"Prompt file not found: {file_path}")

application/api/user/prompts/routes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,23 @@ def get(self):
113113
with open(
114114
os.path.join(current_dir, "prompts", "chat_combine_default.txt"),
115115
"r",
116+
encoding="utf-8",
116117
) as f:
117118
chat_combine_template = f.read()
118119
return make_response(jsonify({"content": chat_combine_template}), 200)
119120
elif prompt_id == "creative":
120121
with open(
121122
os.path.join(current_dir, "prompts", "chat_combine_creative.txt"),
122123
"r",
124+
encoding="utf-8",
123125
) as f:
124126
chat_reduce_creative = f.read()
125127
return make_response(jsonify({"content": chat_reduce_creative}), 200)
126128
elif prompt_id == "strict":
127129
with open(
128-
os.path.join(current_dir, "prompts", "chat_combine_strict.txt"), "r"
130+
os.path.join(current_dir, "prompts", "chat_combine_strict.txt"),
131+
"r",
132+
encoding="utf-8",
129133
) as f:
130134
chat_reduce_strict = f.read()
131135
return make_response(jsonify({"content": chat_reduce_strict}), 200)

application/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@
8787
if settings.AUTH_TYPE in ("simple_jwt", "session_jwt", "oidc") and not settings.JWT_SECRET_KEY:
8888
key_file = ".jwt_secret_key"
8989
try:
90-
with open(key_file, "r") as f:
90+
with open(key_file, "r", encoding="utf-8") as f:
9191
settings.JWT_SECRET_KEY = f.read().strip()
9292
except FileNotFoundError:
9393
new_key = os.urandom(32).hex()
94-
with open(key_file, "w") as f:
94+
with open(key_file, "w", encoding="utf-8") as f:
9595
f.write(new_key)
9696
settings.JWT_SECRET_KEY = new_key
9797
except Exception as e:

application/parser/file/bulk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def load_data(
248248
parser_metadata = parser.get_file_metadata(input_file)
249249
else:
250250
# do standard read
251-
with open(input_file, "r", errors=self.errors) as f:
251+
with open(input_file, "r", encoding="utf-8", errors=self.errors) as f:
252252
data = f.read()
253253

254254
# Calculate token count for this file

application/parser/file/markdown_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def parse_tups(
119119
self, filepath: Path, errors: str = "ignore"
120120
) -> List[Tuple[Optional[str], str]]:
121121
"""Parse file into tuples."""
122-
with open(filepath, "r") as f:
122+
with open(filepath, "r", encoding="utf-8", errors=errors) as f:
123123
content = f.read()
124124
if self._remove_hyperlinks:
125125
content = self.remove_hyperlinks(content)

application/parser/file/openapi3_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ def parse_file(self, file_path):
4646
f"parameters: {path.parameters}\nmethods: {info}\n"
4747
)
4848
i += 1
49-
with open("results.txt", "w") as f:
49+
with open("results.txt", "w", encoding="utf-8") as f:
5050
f.write(results)
5151
return results

0 commit comments

Comments
 (0)