修改docker-compose
This commit is contained in:
@@ -4,7 +4,8 @@ VITE_PORT=5678
|
||||
VITE_BASE=/
|
||||
|
||||
# 接口地址
|
||||
VITE_GLOB_API_URL=/api
|
||||
VITE_GLOB_API_URL=/api/admin
|
||||
|
||||
VITE_BACKEND_URL=http://localhost:8000
|
||||
|
||||
# 是否开启 Nitro Mock服务,true 为开启,false 为关闭
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { fetchWithAuth } from '#/utils/fetch-with-auth';
|
||||
|
||||
export async function getConversations() {
|
||||
const res = await fetchWithAuth('/chat/api/v1/conversations');
|
||||
const res = await fetchWithAuth('/api/ai/v1/conversations');
|
||||
return await res.json();
|
||||
}
|
||||
|
||||
export async function createConversation() {
|
||||
const response = await fetchWithAuth('/chat/api/v1/conversations', {
|
||||
const response = await fetchWithAuth('/api/ai/v1/conversations', {
|
||||
method: 'POST',
|
||||
});
|
||||
if (!response.ok) {
|
||||
@@ -17,7 +17,7 @@ export async function createConversation() {
|
||||
|
||||
export async function getMessages(conversationId: number) {
|
||||
const res = await fetchWithAuth(
|
||||
`/chat/api/v1/messages?conversation_id=${conversationId}`,
|
||||
`/api/ai/v1/messages?conversation_id=${conversationId}`,
|
||||
);
|
||||
return await res.json();
|
||||
}
|
||||
@@ -32,7 +32,7 @@ export async function fetchAIStream({
|
||||
content,
|
||||
conversation_id,
|
||||
}: FetchAIStreamParams) {
|
||||
const res = await fetchWithAuth('/chat/api/v1/stream', {
|
||||
const res = await fetchWithAuth('/api/ai/v1/stream', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ content, conversation_id }),
|
||||
});
|
||||
|
||||
@@ -20,6 +20,6 @@ export namespace AiAIApiKeyApi {
|
||||
|
||||
export class AiAIApiKeyModel extends BaseModel<AiAIApiKeyApi.AiAIApiKey> {
|
||||
constructor() {
|
||||
super('/ai/ai_api_key/');
|
||||
super('/ai/api_key/');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ function refreshGrid() {
|
||||
v-permission="'ai:ai_api_key:create'"
|
||||
>
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', [$t('ai.api_key.name')]) }}
|
||||
{{ $t('ui.actionTitle.create') }}
|
||||
</Button>
|
||||
</template>
|
||||
</Grid>
|
||||
|
||||
@@ -9,6 +9,7 @@ export default defineConfig(async ({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd());
|
||||
// 这样获取,提供默认值
|
||||
const backendUrl = env.VITE_BACKEND_URL || 'http://localhost:8000';
|
||||
const aiUrl = env.VITE_AI_URL || 'http://localhost:8010';
|
||||
|
||||
// 判断是否为构建模式
|
||||
const isBuild = mode === 'production';
|
||||
@@ -22,11 +23,11 @@ export default defineConfig(async ({ mode }) => {
|
||||
host: '0.0.0.0', // 保证 docker 内外都能访问
|
||||
port: 5678,
|
||||
proxy: {
|
||||
'/chat': {
|
||||
target: 'http://localhost:8010',
|
||||
'/api/ai': {
|
||||
target: aiUrl,
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/api': {
|
||||
'/api/admin': {
|
||||
target: backendUrl,
|
||||
changeOrigin: true,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user