Compare commits
3 Commits
v0.5.11-al
...
v0.5.11-al
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdd4be562d | ||
|
|
37afb313b5 | ||
|
|
c9ebcab8b8 |
@@ -100,7 +100,11 @@ var RelayTimeout = GetOrDefault("RELAY_TIMEOUT", 0) // unit is second
|
|||||||
|
|
||||||
var GeminiSafetySetting = GetOrDefaultString("GEMINI_SAFETY_SETTING", "BLOCK_NONE")
|
var GeminiSafetySetting = GetOrDefaultString("GEMINI_SAFETY_SETTING", "BLOCK_NONE")
|
||||||
|
|
||||||
var Theme = GetOrDefaultString("THEME", "default")
|
var Theme = "default"
|
||||||
|
var ValidThemes = map[string]bool{
|
||||||
|
"default": true,
|
||||||
|
"berry": true,
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RequestIdKey = "X-Oneapi-Request-Id"
|
RequestIdKey = "X-Oneapi-Request-Id"
|
||||||
|
|||||||
@@ -42,6 +42,14 @@ func UpdateOption(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch option.Key {
|
switch option.Key {
|
||||||
|
case "Theme":
|
||||||
|
if !common.ValidThemes[option.Value] {
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"success": false,
|
||||||
|
"message": "无效的主题",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
case "GitHubOAuthEnabled":
|
case "GitHubOAuthEnabled":
|
||||||
if option.Value == "true" && common.GitHubClientId == "" {
|
if option.Value == "true" && common.GitHubClientId == "" {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
|||||||
3
main.go
3
main.go
@@ -20,7 +20,7 @@ var buildFS embed.FS
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
common.SetupLogger()
|
common.SetupLogger()
|
||||||
common.SysLog(fmt.Sprintf("One API %s started with theme %s", common.Version, common.Theme))
|
common.SysLog(fmt.Sprintf("One API %s started", common.Version))
|
||||||
if os.Getenv("GIN_MODE") != "debug" {
|
if os.Getenv("GIN_MODE") != "debug" {
|
||||||
gin.SetMode(gin.ReleaseMode)
|
gin.SetMode(gin.ReleaseMode)
|
||||||
}
|
}
|
||||||
@@ -47,6 +47,7 @@ func main() {
|
|||||||
|
|
||||||
// Initialize options
|
// Initialize options
|
||||||
model.InitOptionMap()
|
model.InitOptionMap()
|
||||||
|
common.SysLog(fmt.Sprintf("using theme %s", common.Theme))
|
||||||
if common.RedisEnabled {
|
if common.RedisEnabled {
|
||||||
// for compatibility with old versions
|
// for compatibility with old versions
|
||||||
common.MemoryCacheEnabled = true
|
common.MemoryCacheEnabled = true
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ const panel = {
|
|||||||
url: '/panel/profile',
|
url: '/panel/profile',
|
||||||
icon: icons.IconUserScan,
|
icon: icons.IconUserScan,
|
||||||
breadcrumbs: false,
|
breadcrumbs: false,
|
||||||
isAdmin: true
|
isAdmin: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'setting',
|
id: 'setting',
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ API.interceptors.response.use(
|
|||||||
if (error.response?.status === 401) {
|
if (error.response?.status === 401) {
|
||||||
localStorage.removeItem('user');
|
localStorage.removeItem('user');
|
||||||
store.dispatch({ type: LOGIN, payload: null });
|
store.dispatch({ type: LOGIN, payload: null });
|
||||||
window.location.href = config.basename + '/login';
|
window.location.href = config.basename + 'login';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error.response?.data?.message) {
|
if (error.response?.data?.message) {
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ const validationSchema = Yup.object().shape({
|
|||||||
then: Yup.string().required("密钥 不能为空"),
|
then: Yup.string().required("密钥 不能为空"),
|
||||||
}),
|
}),
|
||||||
other: Yup.string(),
|
other: Yup.string(),
|
||||||
proxy: Yup.string(),
|
|
||||||
test_model: Yup.string(),
|
|
||||||
models: Yup.array().min(1, "模型 不能为空"),
|
models: Yup.array().min(1, "模型 不能为空"),
|
||||||
groups: Yup.array().min(1, "用户组 不能为空"),
|
groups: Yup.array().min(1, "用户组 不能为空"),
|
||||||
base_url: Yup.string().when("type", {
|
base_url: Yup.string().when("type", {
|
||||||
@@ -623,71 +621,6 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
|
|||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
)}
|
)}
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormControl
|
|
||||||
fullWidth
|
|
||||||
error={Boolean(touched.proxy && errors.proxy)}
|
|
||||||
sx={{ ...theme.typography.otherInput }}
|
|
||||||
>
|
|
||||||
<InputLabel htmlFor="channel-proxy-label">
|
|
||||||
{inputLabel.proxy}
|
|
||||||
</InputLabel>
|
|
||||||
<OutlinedInput
|
|
||||||
id="channel-proxy-label"
|
|
||||||
label={inputLabel.proxy}
|
|
||||||
type="text"
|
|
||||||
value={values.proxy}
|
|
||||||
name="proxy"
|
|
||||||
onBlur={handleBlur}
|
|
||||||
onChange={handleChange}
|
|
||||||
inputProps={{}}
|
|
||||||
aria-describedby="helper-text-channel-proxy-label"
|
|
||||||
/>
|
|
||||||
{touched.proxy && errors.proxy ? (
|
|
||||||
<FormHelperText error id="helper-tex-channel-proxy-label">
|
|
||||||
{errors.proxy}
|
|
||||||
</FormHelperText>
|
|
||||||
) : (
|
|
||||||
<FormHelperText id="helper-tex-channel-proxy-label">
|
|
||||||
{" "}
|
|
||||||
{inputPrompt.proxy}{" "}
|
|
||||||
</FormHelperText>
|
|
||||||
)}
|
|
||||||
</FormControl>
|
|
||||||
{inputPrompt.test_model && (
|
|
||||||
<FormControl
|
|
||||||
fullWidth
|
|
||||||
error={Boolean(touched.test_model && errors.test_model)}
|
|
||||||
sx={{ ...theme.typography.otherInput }}
|
|
||||||
>
|
|
||||||
<InputLabel htmlFor="channel-test_model-label">
|
|
||||||
{inputLabel.test_model}
|
|
||||||
</InputLabel>
|
|
||||||
<OutlinedInput
|
|
||||||
id="channel-test_model-label"
|
|
||||||
label={inputLabel.test_model}
|
|
||||||
type="text"
|
|
||||||
value={values.test_model}
|
|
||||||
name="test_model"
|
|
||||||
onBlur={handleBlur}
|
|
||||||
onChange={handleChange}
|
|
||||||
inputProps={{}}
|
|
||||||
aria-describedby="helper-text-channel-test_model-label"
|
|
||||||
/>
|
|
||||||
{touched.test_model && errors.test_model ? (
|
|
||||||
<FormHelperText
|
|
||||||
error
|
|
||||||
id="helper-tex-channel-test_model-label"
|
|
||||||
>
|
|
||||||
{errors.test_model}
|
|
||||||
</FormHelperText>
|
|
||||||
) : (
|
|
||||||
<FormHelperText id="helper-tex-channel-test_model-label">
|
|
||||||
{" "}
|
|
||||||
{inputPrompt.test_model}{" "}
|
|
||||||
</FormHelperText>
|
|
||||||
)}
|
|
||||||
</FormControl>
|
|
||||||
)}
|
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button onClick={onCancel}>取消</Button>
|
<Button onClick={onCancel}>取消</Button>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user