Skip to content

Commit dbc514a

Browse files
committed
增加 iconPosition 允许自由设置功能图标的位置
1 parent 024c9cf commit dbc514a

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

app/api/config/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const DANGER_CONFIG = {
1919
compressModel: serverConfig.compressModel,
2020
customHello: serverConfig.customHello,
2121
UnauthorizedInfo: serverConfig.UnauthorizedInfo,
22+
iconPosition: serverConfig.iconPosition,
2223
translateModel: serverConfig.translateModel,
2324
ocrModel: serverConfig.ocrModel,
2425
sidebarTitle: siderbarConfig.title,

app/components/chat.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,11 @@ function _Chat() {
15061506
Locale.Error.Unauthorized =
15071507
accessStore.UnauthorizedInfo || Locale.Error.Unauthorized;
15081508

1509+
// icon position
1510+
const iconPosition = accessStore.iconPosition.toLowerCase() || "down";
1511+
const iconUpEnabled = iconPosition === "up" || iconPosition === "both";
1512+
const iconDownEnabled = iconPosition === "down" || iconPosition === "both";
1513+
15091514
async function openaiSpeech(text: string) {
15101515
if (speechStatus) {
15111516
ttsPlayer.stop();
@@ -2079,7 +2084,7 @@ function _Chat() {
20792084
</div>
20802085
)}
20812086

2082-
{!isMobileScreen && showActions && (
2087+
{iconUpEnabled && showActions && (
20832088
<div className={styles["chat-message-actions"]}>
20842089
<div className={styles["chat-input-actions"]}>
20852090
<ChatInputActions
@@ -2167,7 +2172,7 @@ function _Chat() {
21672172
message.model ? ` - Model: ${message.model}` : ""
21682173
}`}
21692174
</div>
2170-
{showActions && (
2175+
{iconDownEnabled && showActions && (
21712176
<div className={styles["chat-message-actions"]}>
21722177
<div className={styles["chat-input-actions"]}>
21732178
<ChatInputActions

app/config/server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,5 +186,7 @@ export const getServerSideConfig = () => {
186186
compressModel: process.env.COMPRESS_MODEL,
187187
translateModel: process.env.TRANSLATE_MODEL,
188188
ocrModel: process.env.OCR_MODEL,
189+
190+
iconPosition: process.env.ICON_POSITION || "down",
189191
};
190192
};

app/store/access.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ const DEFAULT_ACCESS_STATE = {
5555
customHello: "",
5656
UnauthorizedInfo: "",
5757

58+
// icon position
59+
iconPosition: "",
60+
5861
// sidebar config
5962
sidebarTitle: "",
6063
sidebarSubTitle: "",
@@ -97,6 +100,10 @@ export const useAccessStore = createPersistStore(
97100
this.fetch();
98101
return get().ocrModel;
99102
},
103+
setIconPosition() {
104+
this.fetch();
105+
return get().iconPosition;
106+
},
100107
setCustomHello() {
101108
this.fetch();
102109
return get().customHello;
@@ -107,7 +114,6 @@ export const useAccessStore = createPersistStore(
107114
},
108115
enabledAccessControl() {
109116
this.fetch();
110-
111117
return get().needCode;
112118
},
113119
getVisionModels() {

0 commit comments

Comments
 (0)