Skip to content

Commit

Permalink
♻️ refactor: move backend api to (backend) folder group
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Oct 5, 2024
1 parent bdc4f4e commit 01c961e
Show file tree
Hide file tree
Showing 68 changed files with 21 additions and 21 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { getAuth } from '@clerk/nextjs/server';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

import { checkAuthMethod, getJWTPayload } from '@/app/api/middleware/auth/utils';
import { checkAuthMethod, getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED } from '@/const/auth';
import { AgentRuntime, LobeRuntimeAI } from '@/libs/agent-runtime';
import { ChatErrorType } from '@/types/fetch';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createErrorResponse } from '@/app/api/errorResponse';
import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
import { AgentRuntime, ChatCompletionErrorPayload } from '@/libs/agent-runtime';
import { ChatErrorType } from '@/types/fetch';
import { ChatStreamPayload } from '@/types/openai/chat';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NextResponse } from 'next/server';

import { createErrorResponse } from '@/app/api/errorResponse';
import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
import { ChatCompletionErrorPayload, ModelProvider } from '@/libs/agent-runtime';
import { ChatErrorType } from '@/types/fetch';

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getAuth } from '@clerk/nextjs/server';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

import { createErrorResponse } from '@/app/api/errorResponse';
import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
import { AgentRuntimeError } from '@/libs/agent-runtime';
import { ChatErrorType } from '@/types/fetch';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AuthObject } from '@clerk/backend';
import { getAuth } from '@clerk/nextjs/server';
import { NextRequest } from 'next/server';

import { createErrorResponse } from '@/app/api/errorResponse';
import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
import { JWTPayload, LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableClerk } from '@/const/auth';
import { AgentRuntime, AgentRuntimeError, ChatCompletionErrorPayload } from '@/libs/agent-runtime';
import { ChatErrorType } from '@/types/fetch';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PluginRequestPayload } from '@lobehub/chat-plugin-sdk';
import { createGatewayOnEdgeRuntime } from '@lobehub/chat-plugins-gateway';

import { createErrorResponse } from '@/app/api/errorResponse';
import { getJWTPayload } from '@/app/api/middleware/auth/utils';
import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
import { getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
import { getAppConfig } from '@/config/app';
import { LOBE_CHAT_AUTH_HEADER, OAUTH_AUTHORIZED, enableNextAuth } from '@/const/auth';
import { LOBE_CHAT_TRACE_ID, TraceNameMap } from '@/const/trace';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OpenAISTTPayload } from '@lobehub/tts';
import { createOpenaiAudioTranscriptions } from '@lobehub/tts/server';

import { createBizOpenAI } from '@/app/api/openai/createBizOpenAI';
import { createBizOpenAI } from '@/app/(backend)/api/openai/createBizOpenAI';

export const runtime = 'edge';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NextResponse } from 'next/server';

import { initAgentRuntimeWithUserPayload } from '@/app/api/chat/agentRuntime';
import { createErrorResponse } from '@/app/api/errorResponse';
import { checkAuth } from '@/app/api/middleware/auth';
import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
import { checkAuth } from '@/app/(backend)/api/middleware/auth';
import { ChatCompletionErrorPayload } from '@/libs/agent-runtime';
import { TextToImagePayload } from '@/libs/agent-runtime/types';
import { ChatErrorType } from '@/types/fetch';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { OpenAITTSPayload } from '@lobehub/tts';
import { createOpenaiAudioSpeech } from '@lobehub/tts/server';

import { createBizOpenAI } from '@/app/api/openai/createBizOpenAI';
import { createBizOpenAI } from '@/app/(backend)/api/openai/createBizOpenAI';

export const runtime = 'edge';

Expand Down
2 changes: 1 addition & 1 deletion src/libs/agent-runtime/AgentRuntime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { LangfuseGenerationClient, LangfuseTraceClient } from 'langfuse-core';
import { ClientOptions } from 'openai';
import { beforeEach, describe, expect, it, vi } from 'vitest';

import { createTraceOptions } from '@/app/api/chat/agentRuntime';
import { createTraceOptions } from '@/app/(backend)/api/chat/agentRuntime';
import * as langfuseCfg from '@/config/langfuse';
import { JWTPayload } from '@/const/auth';
import { TraceNameMap } from '@/const/trace';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/trpc/middleware/jwtPayload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { TRPCError } from '@trpc/server';
import { beforeEach, describe, expect, it, vi } from 'vitest';

import * as utils from '@/app/api/middleware/auth/utils';
import * as utils from '@/app/(backend)/api/middleware/auth/utils';
import { createCallerFactory } from '@/libs/trpc';
import { trpc } from '@/libs/trpc/init';
import { AuthContext, createContextInner } from '@/server/context';
Expand Down
2 changes: 1 addition & 1 deletion src/libs/trpc/middleware/jwtPayload.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TRPCError } from '@trpc/server';

import { getJWTPayload } from '@/app/api/middleware/auth/utils';
import { getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
import { trpc } from '@/libs/trpc/init';

export const jwtPayloadChecker = trpc.middleware(async (opts) => {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/trpc/middleware/keyVaults.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TRPCError } from '@trpc/server';

import { getJWTPayload } from '@/app/api/middleware/auth/utils';
import { getJWTPayload } from '@/app/(backend)/api/middleware/auth/utils';
import { trpc } from '@/libs/trpc/init';

export const keyVaults = trpc.middleware(async (opts) => {
Expand Down
2 changes: 1 addition & 1 deletion src/server/routers/async/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { chunk } from 'lodash-es';
import pMap from 'p-map';
import { z } from 'zod';

import { initAgentRuntimeWithUserPayload } from '@/app/api/chat/agentRuntime';
import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
import { fileEnv } from '@/config/file';
import { DEFAULT_EMBEDDING_MODEL } from '@/const/settings';
import { ASYNC_TASK_TIMEOUT, AsyncTaskModel } from '@/database/server/models/asyncTask';
Expand Down
2 changes: 1 addition & 1 deletion src/server/routers/async/ragEval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TRPCError } from '@trpc/server';
import OpenAI from 'openai';
import { z } from 'zod';

import { initAgentRuntimeWithUserPayload } from '@/app/api/chat/agentRuntime';
import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
import { chainAnswerWithContext } from '@/chains/answerWithContext';
import { DEFAULT_EMBEDDING_MODEL, DEFAULT_MODEL } from '@/const/settings';
import { ChunkModel } from '@/database/server/models/chunk';
Expand Down
2 changes: 1 addition & 1 deletion src/server/routers/lambda/chunk.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { inArray } from 'drizzle-orm';
import { z } from 'zod';

import { initAgentRuntimeWithUserPayload } from '@/app/api/chat/agentRuntime';
import { initAgentRuntimeWithUserPayload } from '@/app/(backend)/api/chat/agentRuntime';
import { DEFAULT_EMBEDDING_MODEL } from '@/const/settings';
import { serverDB } from '@/database/server';
import { AsyncTaskModel } from '@/database/server/models/asyncTask';
Expand Down
2 changes: 1 addition & 1 deletion src/services/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PluginRequestPayload, createHeadersWithPluginSettings } from '@lobehub/
import { produce } from 'immer';
import { merge } from 'lodash-es';

import { createErrorResponse } from '@/app/api/errorResponse';
import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
import { DEFAULT_MODEL_PROVIDER_LIST } from '@/config/modelProviders';
import { INBOX_GUIDE_SYSTEMROLE } from '@/const/guide';
import { INBOX_SESSION_ID } from '@/const/session';
Expand Down
2 changes: 1 addition & 1 deletion src/services/ollama.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ListResponse, Ollama as OllamaBrowser, ProgressResponse } from 'ollama/browser';

import { createErrorResponse } from '@/app/api/errorResponse';
import { createErrorResponse } from '@/app/(backend)/api/errorResponse';
import { ModelProvider } from '@/libs/agent-runtime';
import { useUserStore } from '@/store/user';
import { keyVaultsConfigSelectors } from '@/store/user/selectors';
Expand Down

0 comments on commit 01c961e

Please sign in to comment.