mirror of
				https://github.com/songquanpeng/one-api.git
				synced 2025-11-04 07:43:41 +08:00 
			
		
		
		
	feat: support set system_prompt for theme air & berry
This commit is contained in:
		@@ -43,6 +43,7 @@ const EditChannel = (props) => {
 | 
			
		||||
        base_url: '',
 | 
			
		||||
        other: '',
 | 
			
		||||
        model_mapping: '',
 | 
			
		||||
        system_prompt: '',
 | 
			
		||||
        models: [],
 | 
			
		||||
        auto_ban: 1,
 | 
			
		||||
        groups: ['default']
 | 
			
		||||
@@ -304,163 +305,163 @@ const EditChannel = (props) => {
 | 
			
		||||
                width={isMobile() ? '100%' : 600}
 | 
			
		||||
            >
 | 
			
		||||
                <Spin spinning={loading}>
 | 
			
		||||
                    <div style={{marginTop: 10}}>
 | 
			
		||||
                    <div style={{ marginTop: 10 }}>
 | 
			
		||||
                        <Typography.Text strong>类型:</Typography.Text>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <Select
 | 
			
		||||
                        name='type'
 | 
			
		||||
                        required
 | 
			
		||||
                        optionList={CHANNEL_OPTIONS}
 | 
			
		||||
                        value={inputs.type}
 | 
			
		||||
                        onChange={value => handleInputChange('type', value)}
 | 
			
		||||
                        style={{width: '50%'}}
 | 
			
		||||
                      name='type'
 | 
			
		||||
                      required
 | 
			
		||||
                      optionList={CHANNEL_OPTIONS}
 | 
			
		||||
                      value={inputs.type}
 | 
			
		||||
                      onChange={value => handleInputChange('type', value)}
 | 
			
		||||
                      style={{ width: '50%' }}
 | 
			
		||||
                    />
 | 
			
		||||
                    {
 | 
			
		||||
                        inputs.type === 3 && (
 | 
			
		||||
                            <>
 | 
			
		||||
                                <div style={{marginTop: 10}}>
 | 
			
		||||
                                    <Banner type={"warning"} description={
 | 
			
		||||
                                        <>
 | 
			
		||||
                                            注意,<strong>模型部署名称必须和模型名称保持一致</strong>,因为 One API 会把请求体中的
 | 
			
		||||
                                            model
 | 
			
		||||
                                            参数替换为你的部署名称(模型名称中的点会被剔除),<a target='_blank'
 | 
			
		||||
                                                                                              href='https://github.com/songquanpeng/one-api/issues/133?notification_referrer_id=NT_kwDOAmJSYrM2NjIwMzI3NDgyOjM5OTk4MDUw#issuecomment-1571602271'>图片演示</a>。
 | 
			
		||||
                                        </>
 | 
			
		||||
                                    }>
 | 
			
		||||
                                    </Banner>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <div style={{marginTop: 10}}>
 | 
			
		||||
                                    <Typography.Text strong>AZURE_OPENAI_ENDPOINT:</Typography.Text>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <Input
 | 
			
		||||
                                    label='AZURE_OPENAI_ENDPOINT'
 | 
			
		||||
                                    name='azure_base_url'
 | 
			
		||||
                                    placeholder={'请输入 AZURE_OPENAI_ENDPOINT,例如:https://docs-test-001.openai.azure.com'}
 | 
			
		||||
                                    onChange={value => {
 | 
			
		||||
                                        handleInputChange('base_url', value)
 | 
			
		||||
                                    }}
 | 
			
		||||
                                    value={inputs.base_url}
 | 
			
		||||
                                    autoComplete='new-password'
 | 
			
		||||
                                />
 | 
			
		||||
                                <div style={{marginTop: 10}}>
 | 
			
		||||
                                    <Typography.Text strong>默认 API 版本:</Typography.Text>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <Input
 | 
			
		||||
                                    label='默认 API 版本'
 | 
			
		||||
                                    name='azure_other'
 | 
			
		||||
                                    placeholder={'请输入默认 API 版本,例如:2024-03-01-preview,该配置可以被实际的请求查询参数所覆盖'}
 | 
			
		||||
                                    onChange={value => {
 | 
			
		||||
                                        handleInputChange('other', value)
 | 
			
		||||
                                    }}
 | 
			
		||||
                                    value={inputs.other}
 | 
			
		||||
                                    autoComplete='new-password'
 | 
			
		||||
                                />
 | 
			
		||||
                            </>
 | 
			
		||||
                        )
 | 
			
		||||
                      inputs.type === 3 && (
 | 
			
		||||
                        <>
 | 
			
		||||
                            <div style={{ marginTop: 10 }}>
 | 
			
		||||
                                <Banner type={"warning"} description={
 | 
			
		||||
                                    <>
 | 
			
		||||
                                        注意,<strong>模型部署名称必须和模型名称保持一致</strong>,因为 One API 会把请求体中的
 | 
			
		||||
                                        model
 | 
			
		||||
                                        参数替换为你的部署名称(模型名称中的点会被剔除),<a target='_blank'
 | 
			
		||||
                                                                                          href='https://github.com/songquanpeng/one-api/issues/133?notification_referrer_id=NT_kwDOAmJSYrM2NjIwMzI3NDgyOjM5OTk4MDUw#issuecomment-1571602271'>图片演示</a>。
 | 
			
		||||
                                    </>
 | 
			
		||||
                                }>
 | 
			
		||||
                                </Banner>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <div style={{ marginTop: 10 }}>
 | 
			
		||||
                                <Typography.Text strong>AZURE_OPENAI_ENDPOINT:</Typography.Text>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <Input
 | 
			
		||||
                              label='AZURE_OPENAI_ENDPOINT'
 | 
			
		||||
                              name='azure_base_url'
 | 
			
		||||
                              placeholder={'请输入 AZURE_OPENAI_ENDPOINT,例如:https://docs-test-001.openai.azure.com'}
 | 
			
		||||
                              onChange={value => {
 | 
			
		||||
                                  handleInputChange('base_url', value)
 | 
			
		||||
                              }}
 | 
			
		||||
                              value={inputs.base_url}
 | 
			
		||||
                              autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                            <div style={{ marginTop: 10 }}>
 | 
			
		||||
                                <Typography.Text strong>默认 API 版本:</Typography.Text>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <Input
 | 
			
		||||
                              label='默认 API 版本'
 | 
			
		||||
                              name='azure_other'
 | 
			
		||||
                              placeholder={'请输入默认 API 版本,例如:2024-03-01-preview,该配置可以被实际的请求查询参数所覆盖'}
 | 
			
		||||
                              onChange={value => {
 | 
			
		||||
                                  handleInputChange('other', value)
 | 
			
		||||
                              }}
 | 
			
		||||
                              value={inputs.other}
 | 
			
		||||
                              autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                        </>
 | 
			
		||||
                      )
 | 
			
		||||
                    }
 | 
			
		||||
                    {
 | 
			
		||||
                        inputs.type === 8 && (
 | 
			
		||||
                            <>
 | 
			
		||||
                                <div style={{marginTop: 10}}>
 | 
			
		||||
                                    <Typography.Text strong>Base URL:</Typography.Text>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <Input
 | 
			
		||||
                                    name='base_url'
 | 
			
		||||
                                    placeholder={'请输入自定义渠道的 Base URL'}
 | 
			
		||||
                                    onChange={value => {
 | 
			
		||||
                                        handleInputChange('base_url', value)
 | 
			
		||||
                                    }}
 | 
			
		||||
                                    value={inputs.base_url}
 | 
			
		||||
                                    autoComplete='new-password'
 | 
			
		||||
                                />
 | 
			
		||||
                            </>
 | 
			
		||||
                        )
 | 
			
		||||
                      inputs.type === 8 && (
 | 
			
		||||
                        <>
 | 
			
		||||
                            <div style={{ marginTop: 10 }}>
 | 
			
		||||
                                <Typography.Text strong>Base URL:</Typography.Text>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <Input
 | 
			
		||||
                              name='base_url'
 | 
			
		||||
                              placeholder={'请输入自定义渠道的 Base URL'}
 | 
			
		||||
                              onChange={value => {
 | 
			
		||||
                                  handleInputChange('base_url', value)
 | 
			
		||||
                              }}
 | 
			
		||||
                              value={inputs.base_url}
 | 
			
		||||
                              autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                        </>
 | 
			
		||||
                      )
 | 
			
		||||
                    }
 | 
			
		||||
                    <div style={{marginTop: 10}}>
 | 
			
		||||
                    <div style={{ marginTop: 10 }}>
 | 
			
		||||
                        <Typography.Text strong>名称:</Typography.Text>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <Input
 | 
			
		||||
                        required
 | 
			
		||||
                        name='name'
 | 
			
		||||
                        placeholder={'请为渠道命名'}
 | 
			
		||||
                        onChange={value => {
 | 
			
		||||
                            handleInputChange('name', value)
 | 
			
		||||
                        }}
 | 
			
		||||
                        value={inputs.name}
 | 
			
		||||
                        autoComplete='new-password'
 | 
			
		||||
                      required
 | 
			
		||||
                      name='name'
 | 
			
		||||
                      placeholder={'请为渠道命名'}
 | 
			
		||||
                      onChange={value => {
 | 
			
		||||
                          handleInputChange('name', value)
 | 
			
		||||
                      }}
 | 
			
		||||
                      value={inputs.name}
 | 
			
		||||
                      autoComplete='new-password'
 | 
			
		||||
                    />
 | 
			
		||||
                    <div style={{marginTop: 10}}>
 | 
			
		||||
                    <div style={{ marginTop: 10 }}>
 | 
			
		||||
                        <Typography.Text strong>分组:</Typography.Text>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <Select
 | 
			
		||||
                        placeholder={'请选择可以使用该渠道的分组'}
 | 
			
		||||
                        name='groups'
 | 
			
		||||
                        required
 | 
			
		||||
                        multiple
 | 
			
		||||
                        selection
 | 
			
		||||
                        allowAdditions
 | 
			
		||||
                        additionLabel={'请在系统设置页面编辑分组倍率以添加新的分组:'}
 | 
			
		||||
                        onChange={value => {
 | 
			
		||||
                            handleInputChange('groups', value)
 | 
			
		||||
                        }}
 | 
			
		||||
                        value={inputs.groups}
 | 
			
		||||
                        autoComplete='new-password'
 | 
			
		||||
                        optionList={groupOptions}
 | 
			
		||||
                      placeholder={'请选择可以使用该渠道的分组'}
 | 
			
		||||
                      name='groups'
 | 
			
		||||
                      required
 | 
			
		||||
                      multiple
 | 
			
		||||
                      selection
 | 
			
		||||
                      allowAdditions
 | 
			
		||||
                      additionLabel={'请在系统设置页面编辑分组倍率以添加新的分组:'}
 | 
			
		||||
                      onChange={value => {
 | 
			
		||||
                          handleInputChange('groups', value)
 | 
			
		||||
                      }}
 | 
			
		||||
                      value={inputs.groups}
 | 
			
		||||
                      autoComplete='new-password'
 | 
			
		||||
                      optionList={groupOptions}
 | 
			
		||||
                    />
 | 
			
		||||
                    {
 | 
			
		||||
                        inputs.type === 18 && (
 | 
			
		||||
                            <>
 | 
			
		||||
                                <div style={{marginTop: 10}}>
 | 
			
		||||
                                    <Typography.Text strong>模型版本:</Typography.Text>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <Input
 | 
			
		||||
                                    name='other'
 | 
			
		||||
                                    placeholder={'请输入星火大模型版本,注意是接口地址中的版本号,例如:v2.1'}
 | 
			
		||||
                                    onChange={value => {
 | 
			
		||||
                                        handleInputChange('other', value)
 | 
			
		||||
                                    }}
 | 
			
		||||
                                    value={inputs.other}
 | 
			
		||||
                                    autoComplete='new-password'
 | 
			
		||||
                                />
 | 
			
		||||
                            </>
 | 
			
		||||
                        )
 | 
			
		||||
                      inputs.type === 18 && (
 | 
			
		||||
                        <>
 | 
			
		||||
                            <div style={{ marginTop: 10 }}>
 | 
			
		||||
                                <Typography.Text strong>模型版本:</Typography.Text>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <Input
 | 
			
		||||
                              name='other'
 | 
			
		||||
                              placeholder={'请输入星火大模型版本,注意是接口地址中的版本号,例如:v2.1'}
 | 
			
		||||
                              onChange={value => {
 | 
			
		||||
                                  handleInputChange('other', value)
 | 
			
		||||
                              }}
 | 
			
		||||
                              value={inputs.other}
 | 
			
		||||
                              autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                        </>
 | 
			
		||||
                      )
 | 
			
		||||
                    }
 | 
			
		||||
                    {
 | 
			
		||||
                        inputs.type === 21 && (
 | 
			
		||||
                            <>
 | 
			
		||||
                                <div style={{marginTop: 10}}>
 | 
			
		||||
                                    <Typography.Text strong>知识库 ID:</Typography.Text>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <Input
 | 
			
		||||
                                    label='知识库 ID'
 | 
			
		||||
                                    name='other'
 | 
			
		||||
                                    placeholder={'请输入知识库 ID,例如:123456'}
 | 
			
		||||
                                    onChange={value => {
 | 
			
		||||
                                        handleInputChange('other', value)
 | 
			
		||||
                                    }}
 | 
			
		||||
                                    value={inputs.other}
 | 
			
		||||
                                    autoComplete='new-password'
 | 
			
		||||
                                />
 | 
			
		||||
                            </>
 | 
			
		||||
                        )
 | 
			
		||||
                      inputs.type === 21 && (
 | 
			
		||||
                        <>
 | 
			
		||||
                            <div style={{ marginTop: 10 }}>
 | 
			
		||||
                                <Typography.Text strong>知识库 ID:</Typography.Text>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <Input
 | 
			
		||||
                              label='知识库 ID'
 | 
			
		||||
                              name='other'
 | 
			
		||||
                              placeholder={'请输入知识库 ID,例如:123456'}
 | 
			
		||||
                              onChange={value => {
 | 
			
		||||
                                  handleInputChange('other', value)
 | 
			
		||||
                              }}
 | 
			
		||||
                              value={inputs.other}
 | 
			
		||||
                              autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                        </>
 | 
			
		||||
                      )
 | 
			
		||||
                    }
 | 
			
		||||
                    <div style={{marginTop: 10}}>
 | 
			
		||||
                    <div style={{ marginTop: 10 }}>
 | 
			
		||||
                        <Typography.Text strong>模型:</Typography.Text>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <Select
 | 
			
		||||
                        placeholder={'请选择该渠道所支持的模型'}
 | 
			
		||||
                        name='models'
 | 
			
		||||
                        required
 | 
			
		||||
                        multiple
 | 
			
		||||
                        selection
 | 
			
		||||
                        onChange={value => {
 | 
			
		||||
                            handleInputChange('models', value)
 | 
			
		||||
                        }}
 | 
			
		||||
                        value={inputs.models}
 | 
			
		||||
                        autoComplete='new-password'
 | 
			
		||||
                        optionList={modelOptions}
 | 
			
		||||
                      placeholder={'请选择该渠道所支持的模型'}
 | 
			
		||||
                      name='models'
 | 
			
		||||
                      required
 | 
			
		||||
                      multiple
 | 
			
		||||
                      selection
 | 
			
		||||
                      onChange={value => {
 | 
			
		||||
                          handleInputChange('models', value)
 | 
			
		||||
                      }}
 | 
			
		||||
                      value={inputs.models}
 | 
			
		||||
                      autoComplete='new-password'
 | 
			
		||||
                      optionList={modelOptions}
 | 
			
		||||
                    />
 | 
			
		||||
                    <div style={{lineHeight: '40px', marginBottom: '12px'}}>
 | 
			
		||||
                    <div style={{ lineHeight: '40px', marginBottom: '12px' }}>
 | 
			
		||||
                        <Space>
 | 
			
		||||
                            <Button type='primary' onClick={() => {
 | 
			
		||||
                                handleInputChange('models', basicModels);
 | 
			
		||||
@@ -473,28 +474,41 @@ const EditChannel = (props) => {
 | 
			
		||||
                            }}>清除所有模型</Button>
 | 
			
		||||
                        </Space>
 | 
			
		||||
                        <Input
 | 
			
		||||
                            addonAfter={
 | 
			
		||||
                                <Button type='primary' onClick={addCustomModel}>填入</Button>
 | 
			
		||||
                            }
 | 
			
		||||
                            placeholder='输入自定义模型名称'
 | 
			
		||||
                            value={customModel}
 | 
			
		||||
                            onChange={(value) => {
 | 
			
		||||
                                setCustomModel(value.trim());
 | 
			
		||||
                            }}
 | 
			
		||||
                          addonAfter={
 | 
			
		||||
                              <Button type='primary' onClick={addCustomModel}>填入</Button>
 | 
			
		||||
                          }
 | 
			
		||||
                          placeholder='输入自定义模型名称'
 | 
			
		||||
                          value={customModel}
 | 
			
		||||
                          onChange={(value) => {
 | 
			
		||||
                              setCustomModel(value.trim());
 | 
			
		||||
                          }}
 | 
			
		||||
                        />
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div style={{marginTop: 10}}>
 | 
			
		||||
                    <div style={{ marginTop: 10 }}>
 | 
			
		||||
                        <Typography.Text strong>模型重定向:</Typography.Text>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <TextArea
 | 
			
		||||
                        placeholder={`此项可选,用于修改请求体中的模型名称,为一个 JSON 字符串,键为请求中模型名称,值为要替换的模型名称,例如:\n${JSON.stringify(MODEL_MAPPING_EXAMPLE, null, 2)}`}
 | 
			
		||||
                        name='model_mapping'
 | 
			
		||||
                        onChange={value => {
 | 
			
		||||
                            handleInputChange('model_mapping', value)
 | 
			
		||||
                        }}
 | 
			
		||||
                        autosize
 | 
			
		||||
                        value={inputs.model_mapping}
 | 
			
		||||
                        autoComplete='new-password'
 | 
			
		||||
                      placeholder={`此项可选,用于修改请求体中的模型名称,为一个 JSON 字符串,键为请求中模型名称,值为要替换的模型名称,例如:\n${JSON.stringify(MODEL_MAPPING_EXAMPLE, null, 2)}`}
 | 
			
		||||
                      name='model_mapping'
 | 
			
		||||
                      onChange={value => {
 | 
			
		||||
                          handleInputChange('model_mapping', value)
 | 
			
		||||
                      }}
 | 
			
		||||
                      autosize
 | 
			
		||||
                      value={inputs.model_mapping}
 | 
			
		||||
                      autoComplete='new-password'
 | 
			
		||||
                    />
 | 
			
		||||
                    <div style={{ marginTop: 10 }}>
 | 
			
		||||
                        <Typography.Text strong>系统提示词:</Typography.Text>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <TextArea
 | 
			
		||||
                      placeholder={`此项可选,用于强制设置给定的系统提示词,请配合自定义模型 & 模型重定向使用,首先创建一个唯一的自定义模型名称并在上面填入,之后将该自定义模型重定向映射到该渠道一个原生支持的模型`}
 | 
			
		||||
                      name='system_prompt'
 | 
			
		||||
                      onChange={value => {
 | 
			
		||||
                          handleInputChange('system_prompt', value)
 | 
			
		||||
                      }}
 | 
			
		||||
                      autosize
 | 
			
		||||
                      value={inputs.system_prompt}
 | 
			
		||||
                      autoComplete='new-password'
 | 
			
		||||
                    />
 | 
			
		||||
                    <Typography.Text style={{
 | 
			
		||||
                        color: 'rgba(var(--semi-blue-5), 1)',
 | 
			
		||||
@@ -507,116 +521,116 @@ const EditChannel = (props) => {
 | 
			
		||||
                    }>
 | 
			
		||||
                        填入模板
 | 
			
		||||
                    </Typography.Text>
 | 
			
		||||
                    <div style={{marginTop: 10}}>
 | 
			
		||||
                    <div style={{ marginTop: 10 }}>
 | 
			
		||||
                        <Typography.Text strong>密钥:</Typography.Text>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    {
 | 
			
		||||
                        batch ?
 | 
			
		||||
                            <TextArea
 | 
			
		||||
                                label='密钥'
 | 
			
		||||
                                name='key'
 | 
			
		||||
                                required
 | 
			
		||||
                                placeholder={'请输入密钥,一行一个'}
 | 
			
		||||
                                onChange={value => {
 | 
			
		||||
                                    handleInputChange('key', value)
 | 
			
		||||
                                }}
 | 
			
		||||
                                value={inputs.key}
 | 
			
		||||
                                style={{minHeight: 150, fontFamily: 'JetBrains Mono, Consolas'}}
 | 
			
		||||
                                autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                            :
 | 
			
		||||
                            <Input
 | 
			
		||||
                                label='密钥'
 | 
			
		||||
                                name='key'
 | 
			
		||||
                                required
 | 
			
		||||
                                placeholder={type2secretPrompt(inputs.type)}
 | 
			
		||||
                                onChange={value => {
 | 
			
		||||
                                    handleInputChange('key', value)
 | 
			
		||||
                                }}
 | 
			
		||||
                                value={inputs.key}
 | 
			
		||||
                                autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                          <TextArea
 | 
			
		||||
                            label='密钥'
 | 
			
		||||
                            name='key'
 | 
			
		||||
                            required
 | 
			
		||||
                            placeholder={'请输入密钥,一行一个'}
 | 
			
		||||
                            onChange={value => {
 | 
			
		||||
                                handleInputChange('key', value)
 | 
			
		||||
                            }}
 | 
			
		||||
                            value={inputs.key}
 | 
			
		||||
                            style={{ minHeight: 150, fontFamily: 'JetBrains Mono, Consolas' }}
 | 
			
		||||
                            autoComplete='new-password'
 | 
			
		||||
                          />
 | 
			
		||||
                          :
 | 
			
		||||
                          <Input
 | 
			
		||||
                            label='密钥'
 | 
			
		||||
                            name='key'
 | 
			
		||||
                            required
 | 
			
		||||
                            placeholder={type2secretPrompt(inputs.type)}
 | 
			
		||||
                            onChange={value => {
 | 
			
		||||
                                handleInputChange('key', value)
 | 
			
		||||
                            }}
 | 
			
		||||
                            value={inputs.key}
 | 
			
		||||
                            autoComplete='new-password'
 | 
			
		||||
                          />
 | 
			
		||||
                    }
 | 
			
		||||
                    <div style={{marginTop: 10}}>
 | 
			
		||||
                    <div style={{ marginTop: 10 }}>
 | 
			
		||||
                        <Typography.Text strong>组织:</Typography.Text>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <Input
 | 
			
		||||
                        label='组织,可选,不填则为默认组织'
 | 
			
		||||
                        name='openai_organization'
 | 
			
		||||
                        placeholder='请输入组织org-xxx'
 | 
			
		||||
                        onChange={value => {
 | 
			
		||||
                            handleInputChange('openai_organization', value)
 | 
			
		||||
                        }}
 | 
			
		||||
                        value={inputs.openai_organization}
 | 
			
		||||
                      label='组织,可选,不填则为默认组织'
 | 
			
		||||
                      name='openai_organization'
 | 
			
		||||
                      placeholder='请输入组织org-xxx'
 | 
			
		||||
                      onChange={value => {
 | 
			
		||||
                          handleInputChange('openai_organization', value)
 | 
			
		||||
                      }}
 | 
			
		||||
                      value={inputs.openai_organization}
 | 
			
		||||
                    />
 | 
			
		||||
                    <div style={{marginTop: 10, display: 'flex'}}>
 | 
			
		||||
                    <div style={{ marginTop: 10, display: 'flex' }}>
 | 
			
		||||
                        <Space>
 | 
			
		||||
                            <Checkbox
 | 
			
		||||
                                name='auto_ban'
 | 
			
		||||
                                checked={autoBan}
 | 
			
		||||
                                onChange={
 | 
			
		||||
                                    () => {
 | 
			
		||||
                                        setAutoBan(!autoBan);
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                                // onChange={handleInputChange}
 | 
			
		||||
                              name='auto_ban'
 | 
			
		||||
                              checked={autoBan}
 | 
			
		||||
                              onChange={
 | 
			
		||||
                                  () => {
 | 
			
		||||
                                      setAutoBan(!autoBan);
 | 
			
		||||
                                  }
 | 
			
		||||
                              }
 | 
			
		||||
                              // onChange={handleInputChange}
 | 
			
		||||
                            />
 | 
			
		||||
                            <Typography.Text
 | 
			
		||||
                                strong>是否自动禁用(仅当自动禁用开启时有效),关闭后不会自动禁用该渠道:</Typography.Text>
 | 
			
		||||
                              strong>是否自动禁用(仅当自动禁用开启时有效),关闭后不会自动禁用该渠道:</Typography.Text>
 | 
			
		||||
                        </Space>
 | 
			
		||||
                    </div>
 | 
			
		||||
 | 
			
		||||
                    {
 | 
			
		||||
                        !isEdit && (
 | 
			
		||||
                            <div style={{marginTop: 10, display: 'flex'}}>
 | 
			
		||||
                                <Space>
 | 
			
		||||
                                    <Checkbox
 | 
			
		||||
                                        checked={batch}
 | 
			
		||||
                                        label='批量创建'
 | 
			
		||||
                                        name='batch'
 | 
			
		||||
                                        onChange={() => setBatch(!batch)}
 | 
			
		||||
                                    />
 | 
			
		||||
                                    <Typography.Text strong>批量创建</Typography.Text>
 | 
			
		||||
                                </Space>
 | 
			
		||||
                      !isEdit && (
 | 
			
		||||
                        <div style={{ marginTop: 10, display: 'flex' }}>
 | 
			
		||||
                            <Space>
 | 
			
		||||
                                <Checkbox
 | 
			
		||||
                                  checked={batch}
 | 
			
		||||
                                  label='批量创建'
 | 
			
		||||
                                  name='batch'
 | 
			
		||||
                                  onChange={() => setBatch(!batch)}
 | 
			
		||||
                                />
 | 
			
		||||
                                <Typography.Text strong>批量创建</Typography.Text>
 | 
			
		||||
                            </Space>
 | 
			
		||||
                        </div>
 | 
			
		||||
                      )
 | 
			
		||||
                    }
 | 
			
		||||
                    {
 | 
			
		||||
                      inputs.type !== 3 && inputs.type !== 8 && inputs.type !== 22 && (
 | 
			
		||||
                        <>
 | 
			
		||||
                            <div style={{ marginTop: 10 }}>
 | 
			
		||||
                                <Typography.Text strong>代理:</Typography.Text>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        )
 | 
			
		||||
                            <Input
 | 
			
		||||
                              label='代理'
 | 
			
		||||
                              name='base_url'
 | 
			
		||||
                              placeholder={'此项可选,用于通过代理站来进行 API 调用'}
 | 
			
		||||
                              onChange={value => {
 | 
			
		||||
                                  handleInputChange('base_url', value)
 | 
			
		||||
                              }}
 | 
			
		||||
                              value={inputs.base_url}
 | 
			
		||||
                              autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                        </>
 | 
			
		||||
                      )
 | 
			
		||||
                    }
 | 
			
		||||
                    {
 | 
			
		||||
                        inputs.type !== 3 && inputs.type !== 8 && inputs.type !== 22 && (
 | 
			
		||||
                            <>
 | 
			
		||||
                                <div style={{marginTop: 10}}>
 | 
			
		||||
                                    <Typography.Text strong>代理:</Typography.Text>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <Input
 | 
			
		||||
                                    label='代理'
 | 
			
		||||
                                    name='base_url'
 | 
			
		||||
                                    placeholder={'此项可选,用于通过代理站来进行 API 调用'}
 | 
			
		||||
                                    onChange={value => {
 | 
			
		||||
                                        handleInputChange('base_url', value)
 | 
			
		||||
                                    }}
 | 
			
		||||
                                    value={inputs.base_url}
 | 
			
		||||
                                    autoComplete='new-password'
 | 
			
		||||
                                />
 | 
			
		||||
                            </>
 | 
			
		||||
                        )
 | 
			
		||||
                    }
 | 
			
		||||
                    {
 | 
			
		||||
                        inputs.type === 22 && (
 | 
			
		||||
                            <>
 | 
			
		||||
                                <div style={{marginTop: 10}}>
 | 
			
		||||
                                    <Typography.Text strong>私有部署地址:</Typography.Text>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <Input
 | 
			
		||||
                                    name='base_url'
 | 
			
		||||
                                    placeholder={'请输入私有部署地址,格式为:https://fastgpt.run/api/openapi'}
 | 
			
		||||
                                    onChange={value => {
 | 
			
		||||
                                        handleInputChange('base_url', value)
 | 
			
		||||
                                    }}
 | 
			
		||||
                                    value={inputs.base_url}
 | 
			
		||||
                                    autoComplete='new-password'
 | 
			
		||||
                                />
 | 
			
		||||
                            </>
 | 
			
		||||
                        )
 | 
			
		||||
                      inputs.type === 22 && (
 | 
			
		||||
                        <>
 | 
			
		||||
                            <div style={{ marginTop: 10 }}>
 | 
			
		||||
                                <Typography.Text strong>私有部署地址:</Typography.Text>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <Input
 | 
			
		||||
                              name='base_url'
 | 
			
		||||
                              placeholder={'请输入私有部署地址,格式为:https://fastgpt.run/api/openapi'}
 | 
			
		||||
                              onChange={value => {
 | 
			
		||||
                                  handleInputChange('base_url', value)
 | 
			
		||||
                              }}
 | 
			
		||||
                              value={inputs.base_url}
 | 
			
		||||
                              autoComplete='new-password'
 | 
			
		||||
                            />
 | 
			
		||||
                        </>
 | 
			
		||||
                      )
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                </Spin>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user