Skip to content

Commit f434493

Browse files
author
linyuan.yang
committed
workpath
1 parent 4ff6295 commit f434493

3 files changed

Lines changed: 8 additions & 16 deletions

File tree

‎packages/chat-ui/src/components/ChatArea.vue‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,21 +305,19 @@ defineExpose({ scrollToBottom })
305305
@update:model-value="(v) => emit('update-config', 'saver', v[0] ?? '')"
306306
/>
307307
</div>
308-
<div class="chatui-input-config-item chatui-input-config-path-wrap">
308+
<div v-if="!workPathReadonly" class="chatui-input-config-item chatui-input-config-path-wrap">
309309
<button
310310
class="chatui-input-config-path"
311-
:class="{ 'chatui-input-config-path--readonly': workPathReadonly }"
312-
:disabled="workPathReadonly"
313311
:title="workPath || L.workpathPlaceholder"
314-
@click="!workPathReadonly && emit('open-path-picker', workPath)"
312+
@click="emit('open-path-picker', workPath)"
315313
>
316314
<svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round">
317315
<path d="M2 5.5A1.5 1.5 0 0 1 3.5 4h3l1.2 1.5H12.5A1.5 1.5 0 0 1 14 7v4.5A1.5 1.5 0 0 1 12.5 13h-9A1.5 1.5 0 0 1 2 11.5Z" />
318316
</svg>
319317
<span class="chatui-input-config-path-text">{{ workPath || L.workpathPlaceholder }}</span>
320318
</button>
321319
<button
322-
v-if="workPath && !workPathReadonly"
320+
v-if="workPath"
323321
class="chatui-input-config-clear"
324322
:title="L.close"
325323
@click="emit('update-config', 'workPath', undefined)"

‎packages/sbot/src/Channel/web/WebService.ts‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { WebSocket, WebSocketServer } from 'ws';
66
import { appendAttachmentsToMessageContent, isEmptyContent, MessageRole, MessageKind, type AttachmentInput, type ChatMessage, type MessageContent, writeAttachmentInput } from "scorpio.ai";
77
import { IChannelService, ChannelSessionHandler, SessionService } from "channel.base";
88
import { WsCommandType, WebChatEventType, WEB_CHANNEL_ID, WEB_CHANNEL_TYPE } from 'sbot.commons';
9-
import { database, type ChannelSessionRow, type SessionProfileRow } from "../../Core/Database";
9+
import { database, type ChannelSessionRow } from "../../Core/Database";
1010
import { sessionManager } from "../../Session/SessionManager";
1111
import { SaverPool } from "../../Agent/SaverPool";
1212
import { LoggerService } from "../../Core/LoggerService";
@@ -80,15 +80,8 @@ export class WebService implements IChannelService {
8080
case WsCommandType.Query: {
8181
const contentCount = Array.isArray(msg.content) ? msg.content.length : typeof msg.content === 'string' ? 1 : 0;
8282
const attCount = msg.attachments?.length ?? 0;
83-
// 客户端(如 vscode 插件)可在每次 Query 携带 workPath,按消息粒度
84-
// 覆盖 profile.workPath;vscode 借此免去按 cwd 过滤会话和建会话时绑路径
85-
if (typeof msg.workPath === 'string' && msg.workPath.trim()) {
86-
const profile = await database.findByPk<SessionProfileRow>(database.sessionProfile, session.profileId);
87-
if (profile && profile.workPath !== msg.workPath) {
88-
await database.update(database.sessionProfile, { workPath: msg.workPath }, { where: { id: session.profileId } });
89-
logger.debug(`ws workPath override: profileId=${session.profileId} "${profile.workPath ?? ''}" -> "${msg.workPath}"`);
90-
}
91-
}
83+
// 客户端(如 vscode 插件)可在每次 Query 携带仅对本轮生效的 workPath。
84+
const workPath = typeof msg.workPath === 'string' && msg.workPath.trim() ? msg.workPath : undefined;
9285
const enriched = await processMessage(msg.content ?? '', msg.attachments, uploadDir);
9386
if (isEmptyContent(enriched)) {
9487
logger.debug(`ws query empty: profileId=${profileId} content=${contentCount} attachments=${attCount}`);
@@ -99,6 +92,7 @@ export class WebService implements IChannelService {
9992
channelId: WEB_CHANNEL_ID,
10093
dbSessionId: session.id,
10194
sessionId: channelSessionId,
95+
workPath,
10296
});
10397
break;
10498
}

‎packages/vscode-extension/src/ChatViewProvider.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export class ChatViewProvider implements vscode.WebviewViewProvider, vscode.Disp
158158
case 'listSessions':
159159
return client.fetchSessions();
160160
case 'createSession':
161-
// workPath 不再在创建时绑;首条消息会带上当前 workspace folder,server 按消息粒度覆盖
161+
// workPath 不在创建时绑定;本地 server 的每条消息都会使用当前 workspace folder。
162162
return client.createSessionNew(args[0]);
163163
case 'deleteSession':
164164
return client.deleteSession(args[0]);

0 commit comments

Comments
 (0)