mirror of
https://github.com/sqlchat/sqlchat.git
synced 2025-09-24 08:36:18 +08:00
19 lines
596 B
TypeScript
19 lines
596 B
TypeScript
import { first } from "lodash-es";
|
|
import { Assistant, Id } from "@/types";
|
|
import * as customAssistantList from "../../assistants";
|
|
|
|
const assistantList: Assistant[] = Object.keys(customAssistantList).map((name) => {
|
|
return {
|
|
...((customAssistantList as any)[name].default as Assistant),
|
|
};
|
|
});
|
|
|
|
export const getAssistantById = (id: Id) => {
|
|
const assistant = assistantList.find((assistant) => assistant.id === id);
|
|
return assistant || (first(assistantList) as Assistant);
|
|
};
|
|
|
|
export const getPromptGeneratorOfAssistant = (assistant: Assistant) => {
|
|
return assistant.getPrompt;
|
|
};
|