@@ -189,6 +189,7 @@ const EditChannelModal = (props) => {
189189 const [ useManualInput , setUseManualInput ] = useState ( false ) ; // 是否使用手动输入模式
190190 const [ keyMode , setKeyMode ] = useState ( 'append' ) ; // 密钥模式:replace(覆盖)或 append(追加)
191191 const [ isEnterpriseAccount , setIsEnterpriseAccount ] = useState ( false ) ; // 是否为企业账户
192+ const [ doubaoApiEditUnlocked , setDoubaoApiEditUnlocked ] = useState ( false ) ; // 豆包渠道自定义 API 地址隐藏入口
192193
193194 // 密钥显示状态
194195 const [ keyDisplayState , setKeyDisplayState ] = useState ( {
@@ -218,6 +219,7 @@ const EditChannelModal = (props) => {
218219 'channelExtraSettings' ,
219220 ] ;
220221 const formContainerRef = useRef ( null ) ;
222+ const doubaoApiClickCountRef = useRef ( 0 ) ;
221223
222224 // 2FA状态更新辅助函数
223225 const updateTwoFAState = ( updates ) => {
@@ -306,6 +308,20 @@ const EditChannelModal = (props) => {
306308 scrollToSection ( availableSections [ newIndex ] ) ;
307309 } ;
308310
311+ const handleApiConfigSecretClick = ( ) => {
312+ if ( inputs . type !== 45 ) return ;
313+ const next = doubaoApiClickCountRef . current + 1 ;
314+ doubaoApiClickCountRef . current = next ;
315+ if ( next >= 10 ) {
316+ setDoubaoApiEditUnlocked ( ( unlocked ) => {
317+ if ( ! unlocked ) {
318+ showInfo ( t ( '已解锁豆包自定义 API 地址编辑' ) ) ;
319+ }
320+ return true ;
321+ } ) ;
322+ }
323+ } ;
324+
309325 // 渠道额外设置状态
310326 const [ channelSettings , setChannelSettings ] = useState ( {
311327 force_format : false ,
@@ -724,6 +740,13 @@ const EditChannelModal = (props) => {
724740 }
725741 } ;
726742
743+ useEffect ( ( ) => {
744+ if ( inputs . type !== 45 ) {
745+ doubaoApiClickCountRef . current = 0 ;
746+ setDoubaoApiEditUnlocked ( false ) ;
747+ }
748+ } , [ inputs . type ] ) ;
749+
727750 useEffect ( ( ) => {
728751 const modelMap = new Map ( ) ;
729752
@@ -823,6 +846,9 @@ const EditChannelModal = (props) => {
823846 setKeyMode ( 'append' ) ;
824847 // 重置企业账户状态
825848 setIsEnterpriseAccount ( false ) ;
849+ // 重置豆包隐藏入口状态
850+ setDoubaoApiEditUnlocked ( false ) ;
851+ doubaoApiClickCountRef . current = 0 ;
826852 // 清空表单中的key_mode字段
827853 if ( formApiRef . current ) {
828854 formApiRef . current . setValue ( 'key_mode' , undefined ) ;
@@ -1959,7 +1985,10 @@ const EditChannelModal = (props) => {
19591985 < div ref = { ( el ) => ( formSectionRefs . current . apiConfig = el ) } >
19601986 < Card className = '!rounded-2xl shadow-sm border-0 mb-6' >
19611987 { /* Header: API Config */ }
1962- < div className = 'flex items-center mb-2' >
1988+ < div
1989+ className = 'flex items-center mb-2'
1990+ onClick = { handleApiConfigSecretClick }
1991+ >
19631992 < Avatar
19641993 size = 'small'
19651994 color = 'green'
@@ -2094,7 +2123,7 @@ const EditChannelModal = (props) => {
20942123 inputs . type !== 8 &&
20952124 inputs . type !== 22 &&
20962125 inputs . type !== 36 &&
2097- inputs . type !== 45 && (
2126+ ( inputs . type !== 45 || doubaoApiEditUnlocked ) && (
20982127 < div >
20992128 < Form . Input
21002129 field = 'base_url'
@@ -2147,7 +2176,7 @@ const EditChannelModal = (props) => {
21472176 </ div >
21482177 ) }
21492178
2150- { inputs . type === 45 && (
2179+ { inputs . type === 45 && ! doubaoApiEditUnlocked && (
21512180 < div >
21522181 < Form . Select
21532182 field = 'base_url'
@@ -2167,6 +2196,10 @@ const EditChannelModal = (props) => {
21672196 label :
21682197 'https://ark.ap-southeast.bytepluses.com' ,
21692198 } ,
2199+ {
2200+ value : 'doubao-coding-plan' ,
2201+ label : 'Doubao Coding Plan' ,
2202+ } ,
21702203 ] }
21712204 defaultValue = 'https://ark.cn-beijing.volces.com'
21722205 />
0 commit comments