perf: llm model definition

This commit is contained in:
Junyan Qin
2025-04-27 17:04:56 +08:00
parent 3003f39e34
commit b85f798364
4 changed files with 14 additions and 13 deletions
@@ -9,7 +9,6 @@ import {
} from "@/app/home/components/dynamic-form/DynamicFormItemConfig"; } from "@/app/home/components/dynamic-form/DynamicFormItemConfig";
import {UUID} from 'uuidjs' import {UUID} from 'uuidjs'
import DynamicFormComponent from "@/app/home/components/dynamic-form/DynamicFormComponent"; import DynamicFormComponent from "@/app/home/components/dynamic-form/DynamicFormComponent";
import {ICreateLLMField} from "@/app/home/models/ICreateLLMField";
import {httpClient} from "@/app/infra/http/HttpClient"; import {httpClient} from "@/app/infra/http/HttpClient";
import { Bot } from "@/app/infra/api/api-types"; import { Bot } from "@/app/infra/api/api-types";
@@ -19,9 +19,6 @@ export default function LLMCard({
<div className={`${styles.basicInfoText} ${styles.bigText}`}> <div className={`${styles.basicInfoText} ${styles.bigText}`}>
{cardVO.name} {cardVO.name}
</div> </div>
<div className={`${styles.basicInfoText}`}>
使{cardVO.model}
</div>
<div className={`${styles.basicInfoText}`}> <div className={`${styles.basicInfoText}`}>
{cardVO.company} {cardVO.company}
</div> </div>
@@ -1,7 +1,6 @@
export interface ILLMCardVO { export interface ILLMCardVO {
id: string; id: string;
name: string; name: string;
model: string;
company: string; company: string;
URL: string; URL: string;
} }
@@ -9,14 +8,12 @@ export interface ILLMCardVO {
export class LLMCardVO implements ILLMCardVO { export class LLMCardVO implements ILLMCardVO {
id: string; id: string;
name: string; name: string;
model: string;
company: string; company: string;
URL: string; URL: string;
constructor(props: ILLMCardVO) { constructor(props: ILLMCardVO) {
this.id = props.id; this.id = props.id;
this.name = props.name; this.name = props.name;
this.model = props.model;
this.company = props.company; this.company = props.company;
this.URL = props.URL; this.URL = props.URL;
} }
@@ -54,13 +54,21 @@ export default function LLMForm({
} }
async function getLLMConfig(id: string): Promise<ICreateLLMField> { async function getLLMConfig(id: string): Promise<ICreateLLMField> {
const llmModel = await httpClient.getProviderLLMModel(id)
let fakeExtraArgs = []
const extraArgs = llmModel.model.extra_args as Record<string, string>
for (const key in extraArgs) {
fakeExtraArgs.push(`${key}:${extraArgs[key]}`)
}
return { return {
name: id, name: llmModel.model.name,
model_provider: "OpenAI", model_provider: llmModel.model.requester,
url: "www.aaa.com", url: llmModel.model.requester_config?.base_url,
api_key: "", api_key: llmModel.model.api_keys[0],
abilities: [], abilities: llmModel.model.abilities,
extra_args: [], extra_args: fakeExtraArgs,
} }
} }