mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-18 08:26:37 +08:00
merge upstream
Signed-off-by: wozulong <>
This commit is contained in:
commit
daa1741aed
@ -41,10 +41,10 @@ func (a *Adaptor) GetRequestURL(info *relaycommon.RelayInfo) (string, error) {
|
||||
return relaycommon.GetFullRequestURL(info.BaseUrl, requestURL, info.ChannelType), nil
|
||||
case common.ChannelTypeMiniMax:
|
||||
return minimax.GetRequestURL(info)
|
||||
//case common.ChannelTypeCustom:
|
||||
// url := info.BaseUrl
|
||||
// url = strings.Replace(url, "{model}", info.UpstreamModelName, -1)
|
||||
// return url, nil
|
||||
case common.ChannelTypeCustom:
|
||||
url := info.BaseUrl
|
||||
url = strings.Replace(url, "{model}", info.UpstreamModelName, -1)
|
||||
return url, nil
|
||||
default:
|
||||
return relaycommon.GetFullRequestURL(info.BaseUrl, info.RequestURLPath, info.ChannelType), nil
|
||||
}
|
||||
|
@ -310,12 +310,12 @@ const ChannelsTable = () => {
|
||||
|
||||
const setChannelFormat = (channels) => {
|
||||
for (let i = 0; i < channels.length; i++) {
|
||||
if (channels[i].type === 8) {
|
||||
showWarning(
|
||||
'检测到您使用了“自定义渠道”类型,请更换为“OpenAI”渠道类型!',
|
||||
);
|
||||
showWarning('下个版本将不再支持“自定义渠道”类型!');
|
||||
}
|
||||
// if (channels[i].type === 8) {
|
||||
// showWarning(
|
||||
// '检测到您使用了“自定义渠道”类型,请更换为“OpenAI”渠道类型!',
|
||||
// );
|
||||
// showWarning('下个版本将不再支持“自定义渠道”类型!');
|
||||
// }
|
||||
channels[i].key = '' + channels[i].id;
|
||||
let test_models = [];
|
||||
channels[i].models.split(',').forEach((item, index) => {
|
||||
|
@ -302,6 +302,9 @@ const LogsTable = () => {
|
||||
let content = '渠道:' + record.channel;
|
||||
if (record.other !== '') {
|
||||
let other = JSON.parse(record.other);
|
||||
if (other === null) {
|
||||
return <></>;
|
||||
}
|
||||
if (other.admin_info !== undefined) {
|
||||
if (
|
||||
other.admin_info.use_channel !== null &&
|
||||
@ -323,6 +326,10 @@ const LogsTable = () => {
|
||||
dataIndex: 'content',
|
||||
render: (text, record, index) => {
|
||||
if (record.other === '') {
|
||||
record.other = '{}';
|
||||
}
|
||||
let other = JSON.parse(record.other);
|
||||
if (other == null) {
|
||||
return (
|
||||
<Paragraph
|
||||
ellipsis={{
|
||||
@ -338,7 +345,6 @@ const LogsTable = () => {
|
||||
</Paragraph>
|
||||
);
|
||||
}
|
||||
let other = JSON.parse(record.other);
|
||||
let content = renderModelPrice(
|
||||
record.prompt_tokens,
|
||||
record.completion_tokens,
|
||||
|
@ -146,11 +146,12 @@ const ModelPricing = () => {
|
||||
render: (text, record, index) => {
|
||||
let content = text;
|
||||
if (record.quota_type === 0) {
|
||||
let inputRatioPrice = record.model_ratio * 2.0 * record.group_ratio;
|
||||
// 这里的 *2 是因为 1倍率=0.002刀,请勿删除
|
||||
let inputRatioPrice = record.model_ratio * 2 * record.group_ratio;
|
||||
let completionRatioPrice =
|
||||
record.model_ratio *
|
||||
record.completion_ratio *
|
||||
2.0 *
|
||||
2 *
|
||||
record.group_ratio;
|
||||
content = (
|
||||
<>
|
||||
|
@ -149,8 +149,9 @@ export function renderModelPrice(
|
||||
if (completionRatio === undefined) {
|
||||
completionRatio = 0;
|
||||
}
|
||||
// 这里的 *2 是因为 1倍率=0.002刀,请勿删除
|
||||
let inputRatioPrice = modelRatio * 2.0 * groupRatio;
|
||||
let completionRatioPrice = modelRatio * completionRatio * 2.0 * groupRatio;
|
||||
let completionRatioPrice = modelRatio * 2.0 * completionRatio * groupRatio;
|
||||
let price =
|
||||
(inputTokens / 1000000) * inputRatioPrice +
|
||||
(completionTokens / 1000000) * completionRatioPrice;
|
||||
|
@ -433,11 +433,15 @@ const EditChannel = (props) => {
|
||||
{inputs.type === 8 && (
|
||||
<>
|
||||
<div style={{ marginTop: 10 }}>
|
||||
<Typography.Text strong>Base URL:</Typography.Text>
|
||||
<Typography.Text strong>
|
||||
完整的 Base URL,支持变量{'{model}'}:
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<Input
|
||||
name='base_url'
|
||||
placeholder={'请输入自定义渠道的 Base URL'}
|
||||
placeholder={
|
||||
'请输入完整的URL,例如:https://api.openai.com/v1/chat/completions'
|
||||
}
|
||||
onChange={(value) => {
|
||||
handleInputChange('base_url', value);
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user