Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ccran
/
lufa-contract
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c269be90
authored
May 14, 2026
by
ccran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 下载文件文件名为Path的BUG
parent
3286bf78
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
5 deletions
+52
-5
core/config.py
+2
-2
mock.py
+41
-0
utils/http_util.py
+9
-3
No files found.
core/config.py
View file @
c269be90
...
...
@@ -39,7 +39,7 @@ FILE_SUFFIX = "-审核批注"
## 关键参数**
use_non_fastgpt_llm
=
False
use_lufa
=
Tru
e
use_lufa
=
Fals
e
use_jp_machine
=
True
## 关键参数**
...
...
@@ -60,7 +60,7 @@ else:
base_backend_url
=
"http://192.168.252.71:48080"
else
:
outer_backend_url
=
"http://172.21.107.45:48080"
base_fastgpt_url
=
"http://172.21.107.45:3
808
0"
base_fastgpt_url
=
"http://172.21.107.45:3
03
0"
base_backend_url
=
"http://172.21.107.45:48080"
segment_review_api_key
=
(
"fastgpt-vLu2JHAfqwEq5FUQhvATFDK0yDS6fs804v7KwWBMyU4sRrHzh4UGl89Zpa"
...
...
mock.py
0 → 100644
View file @
c269be90
import
asyncio
import
json
import
sys
import
types
from
fastapi
import
HTTPException
from
main
import
DocumentParseRequest
,
parse_document
PAYLOAD
=
{
"urls"
:
[
"http://192.168.252.71:48080/admin-api/infra/file/24/get/d7ade63d9599ec4a81b2671df2d8fa48a117cfda96d0396cc8e405d0b9c1a89b.docx"
],
"conversation_id"
:
"0edb7152426b4c298270434f2f8810cd"
,
"ruleset_id"
:
"金盘"
,
}
async
def
main
()
->
None
:
try
:
result
=
await
parse_document
(
DocumentParseRequest
(
**
PAYLOAD
))
except
HTTPException
as
exc
:
print
(
json
.
dumps
(
{
"type"
:
"HTTPException"
,
"status_code"
:
exc
.
status_code
,
"detail"
:
exc
.
detail
,
},
ensure_ascii
=
False
,
indent
=
2
,
)
)
return
print
(
result
.
model_dump_json
(
indent
=
2
))
if
__name__
==
"__main__"
:
asyncio
.
run
(
main
())
utils/http_util.py
View file @
c269be90
...
...
@@ -85,6 +85,12 @@ def upload_file(path, input_url_to_inner=True, output_url_to_inner=False) -> str
raise
Exception
(
f
"上传{path}失败 Response text: {response.text}"
)
def
_download_basename
(
filename
:
str
)
->
str
:
filename
=
unquote
(
filename
.
strip
()
.
strip
(
'"'
))
filename
=
filename
.
replace
(
"
\\
"
,
"/"
)
return
Path
(
filename
)
.
name
or
"downloaded_file"
def
_resolve_download_filename
(
url
:
str
,
response
:
requests
.
Response
)
->
str
:
content_disposition
=
response
.
headers
.
get
(
"content-disposition"
,
""
)
if
content_disposition
:
...
...
@@ -92,13 +98,13 @@ def _resolve_download_filename(url: str, response: requests.Response) -> str:
r"filename\*=(?:UTF-8''|utf-8'')?([^;]+)"
,
content_disposition
)
if
match
:
return
unquote
(
match
.
group
(
1
)
.
strip
()
.
strip
(
'"'
))
return
_download_basename
(
match
.
group
(
1
))
match
=
re
.
search
(
r'filename="?([^";]+)"?'
,
content_disposition
)
if
match
:
return
unquote
(
match
.
group
(
1
)
.
strip
()
.
strip
(
'"'
))
return
_download_basename
(
match
.
group
(
1
))
url_filename
=
Path
(
urlparse
(
url
)
.
path
)
.
name
url_filename
=
_download_basename
(
urlparse
(
url
)
.
path
)
if
url_filename
:
return
url_filename
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment