Skip to content

Commit 2a16e8e

Browse files
committed
fix: Dialogue prefix
1 parent 9ec6078 commit 2a16e8e

File tree

2 files changed

+88
-34
lines changed

2 files changed

+88
-34
lines changed

apps/maxkb/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def page_not_found(request, exception):
111111
return HttpResponseRedirect(a)
112112
index_path = os.path.join(PROJECT_DIR, 'apps', "static", 'chat', 'index.html')
113113
content = get_index_html(index_path)
114-
content.replace("prefix: '/chat'", f"prefix: {CONFIG.get_chat_path()}")
114+
content = content.replace("prefix: '/chat'", f"prefix: {CONFIG.get_chat_path()}")
115115
if not os.path.exists(index_path):
116116
return HttpResponse("页面不存在", status=404)
117117
return HttpResponse(content, status=200)

ui/src/views/application-overview/index.vue

Lines changed: 87 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@
2121
<el-row :gutter="12">
2222
<el-col :span="12" class="mt-16">
2323
<div class="flex">
24-
<el-text type="info">{{ $t('views.applicationOverview.appInfo.publicAccessLink') }}
24+
<el-text type="info"
25+
>{{ $t('views.applicationOverview.appInfo.publicAccessLink') }}
2526
</el-text>
26-
<el-switch v-model="accessToken.is_active" class="ml-8" size="small" inline-prompt
27+
<el-switch
28+
v-model="accessToken.is_active"
29+
class="ml-8"
30+
size="small"
31+
inline-prompt
2732
:active-text="$t('views.applicationOverview.appInfo.openText')"
2833
:inactive-text="$t('views.applicationOverview.appInfo.closeText')"
29-
:before-change="() => changeState(accessToken.is_active)" />
34+
:before-change="() => changeState(accessToken.is_active)"
35+
/>
3036
</div>
3137

3238
<div class="mt-4 mb-16 url-height flex align-center" style="margin-bottom: 37px">
@@ -39,25 +45,38 @@
3945
</el-button>
4046
</el-tooltip>
4147
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
42-
<el-button @click="refreshAccessToken" type="primary" text style="margin-left: 1px">
48+
<el-button
49+
@click="refreshAccessToken"
50+
type="primary"
51+
text
52+
style="margin-left: 1px"
53+
>
4354
<el-icon>
4455
<RefreshRight />
4556
</el-icon>
4657
</el-button>
4758
</el-tooltip>
4859
</div>
4960
<div>
50-
<el-button v-if="accessToken?.is_active" :disabled="!accessToken?.is_active" tag="a" :href="shareUrl"
51-
target="_blank">
61+
<el-button
62+
v-if="accessToken?.is_active"
63+
:disabled="!accessToken?.is_active"
64+
tag="a"
65+
:href="shareUrl"
66+
target="_blank"
67+
>
5268
<AppIcon iconName="app-create-chat" class="mr-4"></AppIcon>
5369
{{ $t('views.application.operation.toChat') }}
5470
</el-button>
5571
<el-button v-else :disabled="!accessToken?.is_active">
5672
<AppIcon iconName="app-create-chat" class="mr-4"></AppIcon>
5773
{{ $t('views.application.operation.toChat') }}
5874
</el-button>
59-
<el-button :disabled="!accessToken?.is_active" @click="openDialog"
60-
v-if="permissionPrecise.overview_embed(id)">
75+
<el-button
76+
:disabled="!accessToken?.is_active"
77+
@click="openDialog"
78+
v-if="permissionPrecise.overview_embed(id)"
79+
>
6180
<AppIcon iconName="app-export" class="mr-4"></AppIcon>
6281
{{ $t('views.applicationOverview.appInfo.embedInWebsite') }}
6382
</el-button>
@@ -69,7 +88,10 @@
6988
{{ $t('views.applicationOverview.appInfo.accessControl') }}
7089
</el-button>
7190
<!-- 显示设置 -->
72-
<el-button @click="openDisplaySettingDialog" v-if="permissionPrecise.overview_display(id)">
91+
<el-button
92+
@click="openDisplaySettingDialog"
93+
v-if="permissionPrecise.overview_display(id)"
94+
>
7395
<el-icon class="mr-4">
7496
<Setting />
7597
</el-icon>
@@ -79,13 +101,19 @@
79101
</el-col>
80102
<el-col :span="12" class="mt-16">
81103
<div class="flex">
82-
<el-text type="info">{{ $t('views.applicationOverview.appInfo.apiAccessCredentials') }}
104+
<el-text type="info"
105+
>{{ $t('views.applicationOverview.appInfo.apiAccessCredentials') }}
83106
</el-text>
84107
</div>
85108
<div class="mt-4 mb-16 url-height">
86109
<div>
87110
<el-text>API {{ $t('common.fileUpload.document') }}: </el-text>
88-
<el-button type="primary" link @click="toUrl(apiUrl)" class="vertical-middle lighter break-all">
111+
<el-button
112+
type="primary"
113+
link
114+
@click="toUrl(apiUrl)"
115+
class="vertical-middle lighter break-all"
116+
>
89117
{{ apiUrl }}
90118
</el-button>
91119
</div>
@@ -96,7 +124,7 @@
96124

97125
<span class="vertical-middle lighter break-all ellipsis-1">{{
98126
baseUrl + id
99-
}}</span>
127+
}}</span>
100128
<el-tooltip effect="dark" :content="$t('common.copy')" placement="top">
101129
<el-button type="primary" text @click="copyClick(baseUrl + id)">
102130
<AppIcon iconName="app-copy"></AppIcon>
@@ -105,7 +133,10 @@
105133
</div>
106134
</div>
107135
<div>
108-
<el-button @click="openAPIKeyDialog" v-if="permissionPrecise.overview_api_key(id)">
136+
<el-button
137+
@click="openAPIKeyDialog"
138+
v-if="permissionPrecise.overview_api_key(id)"
139+
>
109140
<el-icon class="mr-4">
110141
<Key />
111142
</el-icon>
@@ -121,13 +152,29 @@
121152
{{ $t('views.applicationOverview.monitor.monitoringStatistics') }}
122153
</h4>
123154
<div class="mb-16">
124-
<el-select v-model="history_day" class="mr-12" @change="changeDayHandle" style="width: 180px">
125-
<el-option v-for="item in dayOptions" :key="item.value" :label="item.label" :value="item.value" />
155+
<el-select
156+
v-model="history_day"
157+
class="mr-12"
158+
@change="changeDayHandle"
159+
style="width: 180px"
160+
>
161+
<el-option
162+
v-for="item in dayOptions"
163+
:key="item.value"
164+
:label="item.label"
165+
:value="item.value"
166+
/>
126167
</el-select>
127-
<el-date-picker v-if="history_day === 'other'" v-model="daterangeValue" type="daterange"
168+
<el-date-picker
169+
v-if="history_day === 'other'"
170+
v-model="daterangeValue"
171+
type="daterange"
128172
:start-placeholder="$t('views.applicationOverview.monitor.startDatePlaceholder')"
129-
:end-placeholder="$t('views.applicationOverview.monitor.endDatePlaceholder')" format="YYYY-MM-DD"
130-
value-format="YYYY-MM-DD" @change="changeDayRangeHandle" />
173+
:end-placeholder="$t('views.applicationOverview.monitor.endDatePlaceholder')"
174+
format="YYYY-MM-DD"
175+
value-format="YYYY-MM-DD"
176+
@change="changeDayRangeHandle"
177+
/>
131178
</div>
132179
<div v-loading="statisticsLoading">
133180
<StatisticsCharts :data="statisticsData" />
@@ -136,7 +183,11 @@
136183
</div>
137184
</el-scrollbar>
138185

139-
<EmbedDialog ref="EmbedDialogRef" :data="detail" :api-input-params="mapToUrlParams(apiInputParams)" />
186+
<EmbedDialog
187+
ref="EmbedDialogRef"
188+
:data="detail"
189+
:api-input-params="mapToUrlParams(apiInputParams)"
190+
/>
140191
<APIKeyDialog ref="APIKeyDialogRef" />
141192

142193
<!-- 社区版访问限制 -->
@@ -197,7 +248,10 @@ const urlParams = computed(() =>
197248
mapToUrlParams(apiInputParams.value) ? '?' + mapToUrlParams(apiInputParams.value) : '',
198249
)
199250
const shareUrl = computed(
200-
() => `${window.location.origin}/chat/` + accessToken.value?.access_token + urlParams.value,
251+
() =>
252+
`${window.location.origin}${window.MaxKB.chatPrefix}/` +
253+
accessToken.value?.access_token +
254+
urlParams.value,
201255
)
202256
203257
const dayOptions = [
@@ -322,7 +376,7 @@ function refreshAccessToken() {
322376
const str = t('views.applicationOverview.appInfo.refreshToken.refreshSuccess')
323377
updateAccessToken(obj, str)
324378
})
325-
.catch(() => { })
379+
.catch(() => {})
326380
}
327381
328382
async function changeState(bool: boolean) {
@@ -368,20 +422,20 @@ function getDetail() {
368422
.map((v: any) => {
369423
apiInputParams.value = v.properties.api_input_field_list
370424
? v.properties.api_input_field_list.map((v: any) => {
371-
return {
372-
name: v.variable,
373-
value: v.default_value,
374-
}
375-
})
425+
return {
426+
name: v.variable,
427+
value: v.default_value,
428+
}
429+
})
376430
: v.properties.input_field_list
377431
? v.properties.input_field_list
378-
.filter((v: any) => v.assignment_method === 'api_input')
379-
.map((v: any) => {
380-
return {
381-
name: v.variable,
382-
value: v.default_value,
383-
}
384-
})
432+
.filter((v: any) => v.assignment_method === 'api_input')
433+
.map((v: any) => {
434+
return {
435+
name: v.variable,
436+
value: v.default_value,
437+
}
438+
})
385439
: []
386440
})
387441
})

0 commit comments

Comments
 (0)