From dfd2372027e3ed90f08b81871d08702b6f984653 Mon Sep 17 00:00:00 2001 From: shatong <843391622@qq.com> Date: Mon, 30 Sep 2024 11:27:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(env):=20=E6=B7=BB=E5=8A=A0=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E9=85=8D=E7=BD=AE=E5=AD=97=E6=AE=B5=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=95=85=E4=BA=8B=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/shared/services/generate.service.ts | 4 +++- src/environments/environment.prod.ts | 3 ++- src/environments/environment.ts | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/shared/services/generate.service.ts b/src/app/shared/services/generate.service.ts index a1c1a04..ead0952 100644 --- a/src/app/shared/services/generate.service.ts +++ b/src/app/shared/services/generate.service.ts @@ -1,8 +1,9 @@ import { HttpClient } from '@angular/common/http'; import { inject, Injectable } from '@angular/core'; -import { map, Observable } from 'rxjs'; +import { map, Observable, of } from 'rxjs'; import { Res, ResStatus } from '../models/http.model'; import { BattleCharacter, Env, InitCharacter } from '@models'; +import { environment } from 'environments/environment'; @Injectable({ providedIn: 'root' @@ -62,6 +63,7 @@ export class GenerateService { } getStory(character: InitCharacter, env: Env): Observable { + if (!environment.aiEnable) return of('开发环境,跳过故事生成'); return this.http.post>('/api/generate/story', { character, env }).pipe( map(res => { return res.status === ResStatus.Success ? res.data : ''; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3c00a0f..39e2616 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,4 +1,5 @@ export const environment = { production: true, - apiUrl: 'https://wanjie-api.vercel.app' + apiUrl: 'https://wanjie-api.vercel.app', + aiEnable: true }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index c46aeaa..6752fc8 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,4 +1,5 @@ export const environment = { production: false, - apiUrl: '' + apiUrl: '', + aiEnable: false };