Skip to content

Commit

Permalink
♻️ refactor: refactor sensenova provider with LobeOpenAICompatibleFac…
Browse files Browse the repository at this point in the history
…tory (lobehub#5116)
  • Loading branch information
hezhijie0327 authored Dec 25, 2024
1 parent 13f1eb4 commit 5656f39
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 460 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ ENV \
# Qwen
QWEN_API_KEY="" QWEN_MODEL_LIST="" QWEN_PROXY_URL="" \
# SenseNova
SENSENOVA_ACCESS_KEY_ID="" SENSENOVA_ACCESS_KEY_SECRET="" SENSENOVA_MODEL_LIST="" \
SENSENOVA_API_KEY="" SENSENOVA_MODEL_LIST="" \
# SiliconCloud
SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
# Spark
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.database
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ ENV \
# Qwen
QWEN_API_KEY="" QWEN_MODEL_LIST="" QWEN_PROXY_URL="" \
# SenseNova
SENSENOVA_ACCESS_KEY_ID="" SENSENOVA_ACCESS_KEY_SECRET="" SENSENOVA_MODEL_LIST="" \
SENSENOVA_API_KEY="" SENSENOVA_MODEL_LIST="" \
# SiliconCloud
SILICONCLOUD_API_KEY="" SILICONCLOUD_MODEL_LIST="" SILICONCLOUD_PROXY_URL="" \
# Spark
Expand Down
44 changes: 0 additions & 44 deletions src/app/(main)/settings/llm/ProviderList/SenseNova/index.tsx

This file was deleted.

6 changes: 2 additions & 4 deletions src/app/(main)/settings/llm/ProviderList/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
OpenRouterProviderCard,
PerplexityProviderCard,
QwenProviderCard,
SenseNovaProviderCard,
SiliconCloudProviderCard,
SparkProviderCard,
StepfunProviderCard,
Expand All @@ -39,7 +40,6 @@ import { useGithubProvider } from './Github';
import { useHuggingFaceProvider } from './HuggingFace';
import { useOllamaProvider } from './Ollama';
import { useOpenAIProvider } from './OpenAI';
import { useSenseNovaProvider } from './SenseNova';
import { useWenxinProvider } from './Wenxin';

export const useProviderList = (): ProviderItem[] => {
Expand All @@ -51,7 +51,6 @@ export const useProviderList = (): ProviderItem[] => {
const GithubProvider = useGithubProvider();
const HuggingFaceProvider = useHuggingFaceProvider();
const WenxinProvider = useWenxinProvider();
const SenseNovaProvider = useSenseNovaProvider();

return useMemo(
() => [
Expand Down Expand Up @@ -81,7 +80,7 @@ export const useProviderList = (): ProviderItem[] => {
SparkProviderCard,
ZhiPuProviderCard,
ZeroOneProviderCard,
SenseNovaProvider,
SenseNovaProviderCard,
StepfunProviderCard,
MoonshotProviderCard,
BaichuanProviderCard,
Expand All @@ -102,7 +101,6 @@ export const useProviderList = (): ProviderItem[] => {
GithubProvider,
WenxinProvider,
HuggingFaceProvider,
SenseNovaProvider,
],
);
};
9 changes: 3 additions & 6 deletions src/config/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ export const getLLMConfig = () => {
HUGGINGFACE_API_KEY: z.string().optional(),

ENABLED_SENSENOVA: z.boolean(),
SENSENOVA_ACCESS_KEY_ID: z.string().optional(),
SENSENOVA_ACCESS_KEY_SECRET: z.string().optional(),
SENSENOVA_API_KEY: z.string().optional(),

ENABLED_XAI: z.boolean(),
XAI_API_KEY: z.string().optional(),
Expand Down Expand Up @@ -234,10 +233,8 @@ export const getLLMConfig = () => {
ENABLED_HUGGINGFACE: !!process.env.HUGGINGFACE_API_KEY,
HUGGINGFACE_API_KEY: process.env.HUGGINGFACE_API_KEY,

ENABLED_SENSENOVA:
!!process.env.SENSENOVA_ACCESS_KEY_ID && !!process.env.SENSENOVA_ACCESS_KEY_SECRET,
SENSENOVA_ACCESS_KEY_ID: process.env.SENSENOVA_ACCESS_KEY_ID,
SENSENOVA_ACCESS_KEY_SECRET: process.env.SENSENOVA_ACCESS_KEY_SECRET,
ENABLED_SENSENOVA: !!process.env.SENSENOVA_API_KEY,
SENSENOVA_API_KEY: process.env.SENSENOVA_API_KEY,

ENABLED_XAI: !!process.env.XAI_API_KEY,
XAI_API_KEY: process.env.XAI_API_KEY,
Expand Down
3 changes: 0 additions & 3 deletions src/const/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ export interface JWTPayload {
wenxinAccessKey?: string;
wenxinSecretKey?: string;

sensenovaAccessKeyID?: string;
sensenovaAccessKeySecret?: string;

/**
* user id
* in client db mode it's a uuid
Expand Down
49 changes: 0 additions & 49 deletions src/features/Conversation/Error/APIKeyForm/SenseNova.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/features/Conversation/Error/APIKeyForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { GlobalLLMProviderKey } from '@/types/user/settings';

import BedrockForm from './Bedrock';
import ProviderApiKeyForm from './ProviderApiKeyForm';
import SenseNovaForm from './SenseNova';
import WenxinForm from './Wenxin';

interface APIKeyFormProps {
Expand Down Expand Up @@ -67,8 +66,6 @@ const APIKeyForm = memo<APIKeyFormProps>(({ id, provider }) => {
<Center gap={16} style={{ maxWidth: 300 }}>
{provider === ModelProvider.Bedrock ? (
<BedrockForm />
) : provider === ModelProvider.SenseNova ? (
<SenseNovaForm />
) : provider === ModelProvider.Wenxin ? (
<WenxinForm />
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/libs/agent-runtime/AgentRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class AgentRuntime {
}

case ModelProvider.SenseNova: {
runtimeModel = await LobeSenseNovaAI.fromAPIKey(params.sensenova);
runtimeModel = new LobeSenseNovaAI(params.sensenova);
break;
}

Expand Down
1 change: 0 additions & 1 deletion src/libs/agent-runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export { LobeOpenAI } from './openai';
export { LobeOpenRouterAI } from './openrouter';
export { LobePerplexityAI } from './perplexity';
export { LobeQwenAI } from './qwen';
export { LobeSenseNovaAI } from './sensenova';
export { LobeTogetherAI } from './togetherai';
export * from './types';
export { AgentRuntimeError } from './utils/createError';
Expand Down
18 changes: 0 additions & 18 deletions src/libs/agent-runtime/sensenova/authToken.test.ts

This file was deleted.

27 changes: 0 additions & 27 deletions src/libs/agent-runtime/sensenova/authToken.ts

This file was deleted.

Loading

0 comments on commit 5656f39

Please sign in to comment.