Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1137,11 +1137,12 @@ async def _load_and_inject_scenes(
return ""

# 构建场景提示词
scene_separator = "\n\n---\n\n"
scene_prompt = f"""# 场景定义

你是根据以下场景定义来协助用户的智能助手。请严格遵循场景定义中的角色设定、工作流程和工具使用规范。

{"\n\n---\n\n".join(scene_contents)}
{scene_separator.join(scene_contents)}

---

Expand Down
12 changes: 10 additions & 2 deletions web/src/app/application/app/components/tab-scenes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,14 @@ export default function TabScenes() {

// 从 appInfo 中获取已选择的场景
useEffect(() => {
if (appInfo?.scenes) {
setSelectedScenes(appInfo.scenes);
if (appInfo?.scenes && appInfo.scenes.length > 0) {
const serverHasNewScenes = appInfo.scenes.some(id => !selectedScenes.includes(id));
const localHasUnsyncedScenes = selectedScenes.some(id => !appInfo.scenes.includes(id));
const isInitializing = selectedScenes.length === 0;

if (serverHasNewScenes || (isInitializing && !localHasUnsyncedScenes)) {
setSelectedScenes(appInfo.scenes);
}
}
}, [appInfo?.scenes]);

Expand Down Expand Up @@ -338,10 +344,12 @@ export default function TabScenes() {

const newScenes = [...selectedScenes, newScene.scene_id];
setSelectedScenes(newScenes);

await fetchUpdateApp({ ...appInfo, scenes: newScenes });

message.success(t('scene_create_success', '场景创建成功'));
setCreateModalVisible(false);

setActiveSceneId(newScene.scene_id);
setEditingContent(defaultContent);
setHasChanges(false);
Expand Down
Loading