@@ -2,10 +2,11 @@ import { getAllCustomModels, deleteModel } from "@/db/models"
2
2
import { useStorage } from "@plasmohq/storage/hook"
3
3
import { useQuery , useQueryClient , useMutation } from "@tanstack/react-query"
4
4
import { Avatar , Skeleton , Table , Tag , Tooltip } from "antd"
5
- import { Pencil , Trash2 } from "lucide-react"
5
+ import { Pencil , Settings , Trash2 } from "lucide-react"
6
6
import { useState } from "react"
7
7
import { useTranslation } from "react-i18next"
8
8
import { ModelNickModelNicknameModal } from "./ModelNicknameModal"
9
+ import { AddUpdateOAIModelSettings } from "./AddUpdateOAIModelSettings"
9
10
10
11
export const CustomModelsTable = ( ) => {
11
12
const [ selectedModel , setSelectedModel ] = useStorage ( "selectedModel" )
@@ -20,7 +21,7 @@ export const CustomModelsTable = () => {
20
21
model_avatar : ""
21
22
} )
22
23
const { t } = useTranslation ( [ "openai" , "common" ] )
23
-
24
+ const [ openSettingsModal , setOpenSettingsModal ] = useState ( false )
24
25
const queryClient = useQueryClient ( )
25
26
26
27
const { data, status } = useQuery ( {
@@ -96,22 +97,39 @@ export const CustomModelsTable = () => {
96
97
{
97
98
title : t ( "manageModels.columns.actions" ) ,
98
99
render : ( _ , record ) => (
99
- < Tooltip title = { t ( "manageModels.tooltip.delete" ) } >
100
- < button
101
- onClick = { ( ) => {
102
- if (
103
- window . confirm ( t ( "manageModels.confirm.delete" ) )
104
- ) {
105
- deleteCustomModel ( record . id )
106
- if ( selectedModel && selectedModel === record . id ) {
107
- setSelectedModel ( null )
100
+ < div className = "flex gap-2" >
101
+ < Tooltip title = { t ( "common:modelSettings.label" ) } >
102
+ < button
103
+ onClick = { ( ) => {
104
+ setModel ( {
105
+ model_id : record . id
106
+ } )
107
+ setOpenSettingsModal ( true )
108
+ } }
109
+ className = "text-gray-700 dark:text-gray-400" >
110
+ < Settings className = "size-4" />
111
+ </ button >
112
+ </ Tooltip >
113
+ < Tooltip title = { t ( "manageModels.tooltip.delete" ) } >
114
+ < button
115
+ onClick = { ( ) => {
116
+ if (
117
+ window . confirm ( t ( "manageModels.confirm.delete" ) )
118
+ ) {
119
+ deleteCustomModel ( record . id )
120
+ if (
121
+ selectedModel &&
122
+ selectedModel === record . id
123
+ ) {
124
+ setSelectedModel ( null )
125
+ }
108
126
}
109
- }
110
- } }
111
- className = "text-red-500 dark:text-red-400" >
112
- < Trash2 className = "w-5 h-5" / >
113
- </ button >
114
- </ Tooltip >
127
+ } }
128
+ className = "text-red-500 dark:text-red-400" >
129
+ < Trash2 className = "w-5 h-5" / >
130
+ </ button >
131
+ </ Tooltip >
132
+ </ div >
115
133
)
116
134
}
117
135
] }
@@ -128,6 +146,12 @@ export const CustomModelsTable = () => {
128
146
model_name = { model . model_name }
129
147
model_avatar = { model . model_avatar }
130
148
/>
149
+
150
+ < AddUpdateOAIModelSettings
151
+ model_id = { model . model_id }
152
+ open = { openSettingsModal }
153
+ setOpen = { setOpenSettingsModal }
154
+ />
131
155
</ div >
132
156
)
133
157
}
0 commit comments