fix provider aliyuncs
This commit is contained in:
1 parent
92fc5db04c
commit
9a723e2a77
3 files changed
+8
-8
No files matched your search
@@ -1,12 +1,12 @@
|
||||
from typing import TypeAlias, Literal
|
||||
|
||||
ProviderType: TypeAlias = Literal["ollama", "bigmodel", "aliyun", "volces", "google", "siliconflow", "default"]
|
||||
ProviderType: TypeAlias = Literal["ollama", "bigmodel", "aliyuncs", "volces", "google", "siliconflow", "default"]
|
||||
|
||||
def get_provider_by_domain(domain:str)->ProviderType:
|
||||
if domain == "open.bigmodel.cn":
|
||||
return "bigmodel"
|
||||
elif domain == "dashscope.aliyuncs.com":
|
||||
return "aliyun"
|
||||
return "aliyuncs"
|
||||
elif domain == "ark.cn-beijing.volces.com":
|
||||
return "volces"
|
||||
elif domain == "generativelanguage.googleapis.com":
|
||||
|
||||
@@ -2,7 +2,7 @@ from typing import TypeAlias, Literal, Any
|
||||
|
||||
from docutranslate.agents.provider import ProviderType
|
||||
|
||||
ModeType: TypeAlias = Literal["ollama", "bigmodel", "aliyun", "volces", "google", "siliconflow", "default"]
|
||||
ModeType: TypeAlias = Literal["ollama", "bigmodel", "aliyuncs", "volces", "google", "siliconflow", "default"]
|
||||
ThinkingField: TypeAlias = str
|
||||
EnableValueType: TypeAlias = str | dict[str,Any] | bool
|
||||
DisableValueType: TypeAlias = str | dict[str,Any] | bool
|
||||
@@ -11,7 +11,7 @@ ThinkingConfig: TypeAlias= tuple[ThinkingField, EnableValueType, DisableValueTyp
|
||||
thinking_mode: dict[ProviderType,ThinkingConfig] = {
|
||||
"ollama": ("reasoning_effort", "medium", "none"),
|
||||
"bigmodel": ("thinking", {"type": "enabled"}, {"type": "disabled"}),
|
||||
"aliyun": (
|
||||
"aliyuncs": (
|
||||
"extra_body",
|
||||
{"enable_thinking": True},
|
||||
{"enable_thinking": False},
|
||||
@@ -44,7 +44,7 @@ def get_thinking_mode_by_model_id(model_id: str) -> ThinkingConfig :
|
||||
if "glm-4.5" in model_id:
|
||||
return thinking_mode["bigmodel"]
|
||||
elif "qwen3" in model_id:
|
||||
return thinking_mode["aliyun"]
|
||||
return thinking_mode["aliyuncs"]
|
||||
elif "seed-1-6" in model_id:
|
||||
return thinking_mode["volces"]
|
||||
elif "gemini" in model_id:
|
||||
@@ -56,8 +56,8 @@ def get_thinking_mode(provider: ProviderType, model_id: str) -> ThinkingConfig :
|
||||
provider = provider
|
||||
if provider == "bigmodel":
|
||||
return thinking_mode["bigmodel"]
|
||||
elif provider == "aliyun":
|
||||
return thinking_mode["aliyun"]
|
||||
elif provider == "aliyuncs":
|
||||
return thinking_mode["aliyuncs"]
|
||||
elif provider == "volces":
|
||||
return thinking_mode["volces"]
|
||||
elif provider == "google":
|
||||
|
||||
@@ -1 +1 @@
|
||||
<!DOCTYPE html>
<html lang="zh-CN" data-bs-theme="auto">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DocuTranslate - 交互式文档翻译</title>
<link rel="icon" href="/static/favicon.ico" type="image/x-icon">
<!-- Bootstrap CSS -->
<link href="/static/bootstrap.css" rel="stylesheet" crossorigin="anonymous">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="/static/bootstrap-icons.css">
<style>
/* 复用原版 CSS */
body {
background-color: var(--bs-body-bg);
}
button:focus {
outline: none !important;
box-shadow: none !important;
}
.main-container {
display: flex;
flex-direction: column;
height: 100vh;
padding-top: 1rem;
padding-bottom: 1rem;
}
.settings-panel {
height: calc(100vh - 2rem);
overflow-y: auto;
padding-right: 15px;
}
.task-area {
height: calc(100vh - 2rem);
overflow-y: auto;
}
.task-card {
transition: all 0.3s ease-in-out;
}
.log-area {
height: 150px;
background-color: var(--bs-tertiary-bg);
border: 1px solid var(--bs-border-color);
border-radius: .375rem;
font-family: monospace;
font-size: 0.8rem;
padding: 10px;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-all;
}
.log-area-wrapper {
position: relative;
}
.copy-log-btn {
position: absolute;
bottom: 5px;
right: 5px;
z-index: 10;
opacity: 0.5;
transition: all 0.2s ease-in-out;
padding: 0.1rem 0.4rem;
line-height: 1;
}
.copy-log-btn:hover {
opacity: 1;
}
.file-drop-area {
border: 2px dashed var(--bs-secondary-bg);
border-radius: .375rem;
padding: 2rem;
text-align: center;
cursor: pointer;
transition: all 0.2s ease-in-out;
background-color: var(--bs-body-bg);
}
.file-drop-area.drag-over {
border-color: var(--bs-primary);
background-color: var(--bs-secondary-bg);
}
.file-drop-area.file-selected {
border-style: solid;
border-color: var(--bs-success);
background-color: var(--bs-success-bg-subtle);
}
.file-drop-area.input-error {
border-color: var(--bs-danger);
}
#previewOffcanvas {
--bs-offcanvas-width: 95vw;
max-width: 1600px;
}
.preview-split-container {
display: flex;
flex-direction: row;
height: 90%;
}
.preview-pane-wrapper {
display: flex;
flex-direction: column;
overflow: hidden;
width: 100%;
height: 100%;
}
.preview-pane-wrapper .preview-pane {
flex-grow: 1;
border: 1px solid var(--bs-border-color);
border-radius: .375rem;
overflow: auto;
position: relative;
}
.gutter {
background-color: var(--bs-tertiary-bg);
background-repeat: no-repeat;
background-position: 50%;
}
.gutter.gutter-horizontal {
cursor: col-resize;
border-left: 1px solid var(--bs-border-color);
border-right: 1px solid var(--bs-border-color);
}
.gutter.gutter-vertical {
cursor: row-resize;
border-top: 1px solid var(--bs-border-color);
border-bottom: 1px solid var(--bs-border-color);
}
.preview-pane iframe {
width: 100%;
height: 100%;
border: none;
}
.preview-pane pre {
margin: 0;
padding: 1rem;
background-color: var(--bs-body-bg);
white-space: pre;
}
.bottom-left-controls {
position: fixed;
bottom: 1rem;
left: 1rem;
z-index: 1050;
display: flex;
gap: 0.5rem;
}
.step-number {
margin-right: 0.25rem;
}
#translatedPreviewContainer .preview-pane {
overflow: hidden;
}
#translatedPreviewContainer .preview-pane iframe {
display: block;
width: 100%;
height: 100%;
}
.lang-list-container {
max-height: 200px;
overflow-y: auto;
border: 1px solid var(--bs-border-color);
border-radius: 0.375rem;
paddinLine truncated
|
||||
<!DOCTYPE html>
<html lang="zh-CN" data-bs-theme="auto">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DocuTranslate - 交互式文档翻译</title>
<link rel="icon" href="/static/favicon.ico" type="image/x-icon">
<!-- Bootstrap CSS -->
<link href="/static/bootstrap.css" rel="stylesheet" crossorigin="anonymous">
<!-- Bootstrap Icons -->
<link rel="stylesheet" href="/static/bootstrap-icons.css">
<style>
/* 复用原版 CSS */
body {
background-color: var(--bs-body-bg);
}
button:focus {
outline: none !important;
box-shadow: none !important;
}
.main-container {
display: flex;
flex-direction: column;
height: 100vh;
padding-top: 1rem;
padding-bottom: 1rem;
}
.settings-panel {
height: calc(100vh - 2rem);
overflow-y: auto;
padding-right: 15px;
}
.task-area {
height: calc(100vh - 2rem);
overflow-y: auto;
}
.task-card {
transition: all 0.3s ease-in-out;
}
.log-area {
height: 150px;
background-color: var(--bs-tertiary-bg);
border: 1px solid var(--bs-border-color);
border-radius: .375rem;
font-family: monospace;
font-size: 0.8rem;
padding: 10px;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-all;
}
.log-area-wrapper {
position: relative;
}
.copy-log-btn {
position: absolute;
bottom: 5px;
right: 5px;
z-index: 10;
opacity: 0.5;
transition: all 0.2s ease-in-out;
padding: 0.1rem 0.4rem;
line-height: 1;
}
.copy-log-btn:hover {
opacity: 1;
}
.file-drop-area {
border: 2px dashed var(--bs-secondary-bg);
border-radius: .375rem;
padding: 2rem;
text-align: center;
cursor: pointer;
transition: all 0.2s ease-in-out;
background-color: var(--bs-body-bg);
}
.file-drop-area.drag-over {
border-color: var(--bs-primary);
background-color: var(--bs-secondary-bg);
}
.file-drop-area.file-selected {
border-style: solid;
border-color: var(--bs-success);
background-color: var(--bs-success-bg-subtle);
}
.file-drop-area.input-error {
border-color: var(--bs-danger);
}
#previewOffcanvas {
--bs-offcanvas-width: 95vw;
max-width: 1600px;
}
.preview-split-container {
display: flex;
flex-direction: row;
height: 90%;
}
.preview-pane-wrapper {
display: flex;
flex-direction: column;
overflow: hidden;
width: 100%;
height: 100%;
}
.preview-pane-wrapper .preview-pane {
flex-grow: 1;
border: 1px solid var(--bs-border-color);
border-radius: .375rem;
overflow: auto;
position: relative;
}
.gutter {
background-color: var(--bs-tertiary-bg);
background-repeat: no-repeat;
background-position: 50%;
}
.gutter.gutter-horizontal {
cursor: col-resize;
border-left: 1px solid var(--bs-border-color);
border-right: 1px solid var(--bs-border-color);
}
.gutter.gutter-vertical {
cursor: row-resize;
border-top: 1px solid var(--bs-border-color);
border-bottom: 1px solid var(--bs-border-color);
}
.preview-pane iframe {
width: 100%;
height: 100%;
border: none;
}
.preview-pane pre {
margin: 0;
padding: 1rem;
background-color: var(--bs-body-bg);
white-space: pre;
}
.bottom-left-controls {
position: fixed;
bottom: 1rem;
left: 1rem;
z-index: 1050;
display: flex;
gap: 0.5rem;
}
.step-number {
margin-right: 0.25rem;
}
#translatedPreviewContainer .preview-pane {
overflow: hidden;
}
#translatedPreviewContainer .preview-pane iframe {
display: block;
width: 100%;
height: 100%;
}
.lang-list-container {
max-height: 200px;
overflow-y: auto;
border: 1px solid var(--bs-border-color);
border-radius: 0.375rem;
paddinLine truncated
|
||||
Reference in new issue
Block a user