chore: embedding model

This commit is contained in:
jialin
2024-07-31 14:47:54 +08:00
parent cfdc731313
commit cca047c7c4
4 changed files with 22 additions and 9 deletions
+12 -6
View File
@@ -18,7 +18,7 @@ import {
} from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { Access, useAccess, useIntl, useNavigate } from '@umijs/max';
import { Button, Input, Space, message } from 'antd';
import { Button, Input, Space, Tag, message } from 'antd';
import dayjs from 'dayjs';
import _ from 'lodash';
import { useCallback, useRef, useState } from 'react';
@@ -336,10 +336,17 @@ const Models: React.FC<ModelsProps> = ({
span={6}
render={(text, record: ListItem) => {
return (
<span>
{record.source === modelSourceMap.huggingface_value
? `${modelSourceMap.huggingface} / ${record.huggingface_filename}`
: `${modelSourceMap.ollama_library} / ${record.ollama_library_model_name}`}
<span className="flex flex-column">
<span>
{record.source === modelSourceMap.huggingface_value
? `${modelSourceMap.huggingface} / ${record.huggingface_filename}`
: `${modelSourceMap.ollama_library} / ${record.ollama_library_model_name}`}
</span>
<span>
{record.embedding_only && (
<Tag style={{ marginTop: 6 }}>Embedding Only</Tag>
)}
</span>
</span>
);
}}
@@ -376,7 +383,6 @@ const Models: React.FC<ModelsProps> = ({
key="operation"
dataIndex="operation"
render={(text, record) => {
console.log('record====9999', record);
return (
<DropdownButtons
items={setActionList(record)}
+1
View File
@@ -4,6 +4,7 @@ export interface ListItem {
huggingface_file_name: string;
huggingface_filename: string;
ollama_library_model_name: string;
embedding_only?: boolean;
ready_replicas: number;
replicas: number;
s3Address: string;
+5 -2
View File
@@ -11,6 +11,9 @@ export async function execChatCompletions(params: any) {
});
}
export const queryModelsList = async () => {
return request(`${OPENAI_MODELS}`);
export const queryModelsList = async (params: any) => {
return request(`${OPENAI_MODELS}`, {
method: 'GET',
params
});
};
@@ -43,7 +43,10 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = ({
useEffect(() => {
const getModelList = async () => {
try {
const res = await queryModelsList();
const params = {
embedding_only: false
};
const res = await queryModelsList(params);
const list = _.map(res.data || [], (item: any) => {
return {
value: item.id,