chore: completion api change
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export default {
|
||||
Create: ['ctrl+n', 'cmd+n'],
|
||||
Save: ['ctrl+s', 'cmd+s'],
|
||||
SaveAs: ['ctrl+shift+s', 'cmd+shift+s'],
|
||||
Open: ['ctrl+o', 'cmd+o'],
|
||||
Cancel: ['ctrl+w', 'cmd+w'],
|
||||
Delete: ['delete'],
|
||||
Copy: ['ctrl+c', 'cmd+c'],
|
||||
Refresh: ['ctrl+r', 'cmd+r'],
|
||||
Edit: ['ctrl+e', 'cmd+e'],
|
||||
Search: ['ctrl+f', 'cmd+f'],
|
||||
Reset: ['ctrl+shift+r', 'cmd+shift+r']
|
||||
};
|
||||
@@ -1,6 +1,8 @@
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
export const CHAT_API = '/chat/completions';
|
||||
export const CHAT_API = '/v1-openai/chat/completions';
|
||||
|
||||
export const OPENAI_MODELS = '/v1-openai/models';
|
||||
|
||||
export async function execChatCompletions(params: any) {
|
||||
return request(`${CHAT_API}`, {
|
||||
@@ -9,8 +11,12 @@ export async function execChatCompletions(params: any) {
|
||||
});
|
||||
}
|
||||
|
||||
export const queryModelsList = async () => {
|
||||
return request(`${OPENAI_MODELS}`);
|
||||
};
|
||||
|
||||
export const fetchChatStream = async (params: any) => {
|
||||
const response = await fetch(`/v1${CHAT_API}`, {
|
||||
const response = await fetch(`${CHAT_API}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(params),
|
||||
headers: {
|
||||
|
||||
@@ -2,11 +2,11 @@ import FieldWrapper from '@/components/seal-form/field-wrapper';
|
||||
import SealInput from '@/components/seal-form/seal-input';
|
||||
import SealSelect from '@/components/seal-form/seal-select';
|
||||
import { INPUT_WIDTH } from '@/constants';
|
||||
import { queryModelsList } from '@/pages/llmodels/apis';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Button, Form, InputNumber, Slider } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { queryModelsList } from '../apis';
|
||||
import CustomLabelStyles from '../style/custom-label.less';
|
||||
|
||||
type ParamsSettingsFormProps = {
|
||||
@@ -44,15 +44,11 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = ({
|
||||
useEffect(() => {
|
||||
const getModelList = async () => {
|
||||
try {
|
||||
const params = {
|
||||
page: 1,
|
||||
perPage: 100
|
||||
};
|
||||
const res = await queryModelsList(params);
|
||||
const list = _.map(res.items || [], (item: any) => {
|
||||
const res = await queryModelsList();
|
||||
const list = _.map(res.data || [], (item: any) => {
|
||||
return {
|
||||
value: item.name,
|
||||
label: item.name
|
||||
value: item.id,
|
||||
label: item.id
|
||||
};
|
||||
});
|
||||
setModelList(list);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RequestConfig } from '@umijs/max';
|
||||
import { message } from 'antd';
|
||||
|
||||
const NoBaseURLAPIs = ['/auth'];
|
||||
const NoBaseURLAPIs = ['/auth', '/v1-openai'];
|
||||
|
||||
export const requestConfig: RequestConfig = {
|
||||
errorConfig: {
|
||||
|
||||
Reference in New Issue
Block a user