mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-03 04:50:52 +08:00
fix: use underscore suffix in short name mapping
Replace the "~<n>" suffix with "_<n>" when generating unique short names in codex translators (Claude, Gemini, OpenAI chat). This avoids using a special character in identifiers, improving compatibility with downstream APIs while preserving length constraints.
This commit is contained in:
@@ -289,7 +289,7 @@ func buildShortNameMap(names []string) map[string]string {
|
|||||||
}
|
}
|
||||||
base := cand
|
base := cand
|
||||||
for i := 1; ; i++ {
|
for i := 1; ; i++ {
|
||||||
suffix := "~" + strconv.Itoa(i)
|
suffix := "_" + strconv.Itoa(i)
|
||||||
allowed := limit - len(suffix)
|
allowed := limit - len(suffix)
|
||||||
if allowed < 0 {
|
if allowed < 0 {
|
||||||
allowed = 0
|
allowed = 0
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ func buildShortNameMap(names []string) map[string]string {
|
|||||||
}
|
}
|
||||||
base := cand
|
base := cand
|
||||||
for i := 1; ; i++ {
|
for i := 1; ; i++ {
|
||||||
suffix := "~" + strconv.Itoa(i)
|
suffix := "_" + strconv.Itoa(i)
|
||||||
allowed := limit - len(suffix)
|
allowed := limit - len(suffix)
|
||||||
if allowed < 0 {
|
if allowed < 0 {
|
||||||
allowed = 0
|
allowed = 0
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ func buildShortNameMap(names []string) map[string]string {
|
|||||||
}
|
}
|
||||||
base := cand
|
base := cand
|
||||||
for i := 1; ; i++ {
|
for i := 1; ; i++ {
|
||||||
suffix := "~" + strconv.Itoa(i)
|
suffix := "_" + strconv.Itoa(i)
|
||||||
allowed := limit - len(suffix)
|
allowed := limit - len(suffix)
|
||||||
if allowed < 0 {
|
if allowed < 0 {
|
||||||
allowed = 0
|
allowed = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user