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'; } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components'; import { PageContainer } from '@ant-design/pro-components';
import { Access, useAccess, useIntl, useNavigate } from '@umijs/max'; 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 dayjs from 'dayjs';
import _ from 'lodash'; import _ from 'lodash';
import { useCallback, useRef, useState } from 'react'; import { useCallback, useRef, useState } from 'react';
@@ -336,10 +336,17 @@ const Models: React.FC<ModelsProps> = ({
span={6} span={6}
render={(text, record: ListItem) => { render={(text, record: ListItem) => {
return ( return (
<span> <span className="flex flex-column">
{record.source === modelSourceMap.huggingface_value <span>
? `${modelSourceMap.huggingface} / ${record.huggingface_filename}` {record.source === modelSourceMap.huggingface_value
: `${modelSourceMap.ollama_library} / ${record.ollama_library_model_name}`} ? `${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> </span>
); );
}} }}
@@ -376,7 +383,6 @@ const Models: React.FC<ModelsProps> = ({
key="operation" key="operation"
dataIndex="operation" dataIndex="operation"
render={(text, record) => { render={(text, record) => {
console.log('record====9999', record);
return ( return (
<DropdownButtons <DropdownButtons
items={setActionList(record)} items={setActionList(record)}
+1
View File
@@ -4,6 +4,7 @@ export interface ListItem {
huggingface_file_name: string; huggingface_file_name: string;
huggingface_filename: string; huggingface_filename: string;
ollama_library_model_name: string; ollama_library_model_name: string;
embedding_only?: boolean;
ready_replicas: number; ready_replicas: number;
replicas: number; replicas: number;
s3Address: string; s3Address: string;
+5 -2
View File
@@ -11,6 +11,9 @@ export async function execChatCompletions(params: any) {
}); });
} }
export const queryModelsList = async () => { export const queryModelsList = async (params: any) => {
return request(`${OPENAI_MODELS}`); return request(`${OPENAI_MODELS}`, {
method: 'GET',
params
});
}; };
@@ -43,7 +43,10 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = ({
useEffect(() => { useEffect(() => {
const getModelList = async () => { const getModelList = async () => {
try { try {
const res = await queryModelsList(); const params = {
embedding_only: false
};
const res = await queryModelsList(params);
const list = _.map(res.data || [], (item: any) => { const list = _.map(res.data || [], (item: any) => {
return { return {
value: item.id, value: item.id,