@@ -92,60 +92,62 @@ public boolean deleteSession(String sessionId) {
9292 * @param request prompt 请求
9393 * @return AI 响应
9494 */
95- public PromptResult prompt (String sessionId , PromptRequest request ) {
95+ public PromptResult chatCompletion (String sessionId , PromptRequest request ) {
9696 return httpClient .prompt (sessionId , request );
9797 }
9898
9999 /**
100100 * 快捷方式:发送纯文本 prompt。
101101 */
102- public PromptResult prompt (String sessionId , String text ) {
102+ public PromptResult chatCompletion (String sessionId , String text ) {
103103 return httpClient .prompt (sessionId , PromptRequest .ofText (text ));
104104 }
105105
106106 /**
107107 * 快捷方式:发送纯文本 prompt 并指定模型。
108108 */
109- public PromptResult prompt (String sessionId , String text , String providerID , String modelID ) {
109+ public PromptResult chatCompletion (String sessionId , String text , String providerID , String modelID ) {
110110 return httpClient .prompt (sessionId , PromptRequest .ofText (text , providerID , modelID ));
111111 }
112112
113113 // ----------------------------------------------------------------
114- // sessionKey 模式(对齐 Hermes/OpenClaw,自动复用/创建 session )
114+ // sessionKey 模式(对齐 Hermes/OpenClaw chatCompletionWithSession )
115115 // ----------------------------------------------------------------
116116
117117 /**
118- * 按 sessionKey 发送 prompt 并同步等待 AI 响应。
119- * <p>sessionKey 同时作为 session 的 title,{@code ensureSession} 保证 session 存在。
118+ * 按 sessionKey 发送消息并同步等待 AI 响应。
119+ * <p>底层基于会话模型(ensureSession + prompt),对外封装为与 Hermes/OpenClaw 对称的
120+ * {@code chatCompletionWithSession} 接口。sessionKey 同时作为 session 的 title,
121+ * {@code ensureSession} 保证 session 存在(不存在则创建)。
120122 * 建议用 {@link io.github.hiwepy.opencode.api.OpenCodeSessionKeys} 生成 sessionKey。</p>
121123 *
122124 * @param sessionKey 会话复用 key
123125 * @param request prompt 请求
124126 * @return AI 响应
125127 */
126- public PromptResult promptByKey (String sessionKey , PromptRequest request ) {
127- return httpClient .promptByKey (sessionKey , request );
128+ public PromptResult chatCompletionWithSession (String sessionKey , PromptRequest request ) {
129+ return httpClient .chatCompletionWithSession (sessionKey , request );
128130 }
129131
130132 /**
131- * 按 sessionKey 发送纯文本 prompt 并同步等待 AI 响应。
133+ * 按 sessionKey 发送纯文本消息并同步等待 AI 响应。
132134 */
133- public PromptResult promptByKey (String sessionKey , String text ) {
134- return httpClient .promptByKey (sessionKey , PromptRequest .ofText (text ));
135+ public PromptResult chatCompletionWithSession (String sessionKey , String text ) {
136+ return httpClient .chatCompletionWithSession (sessionKey , PromptRequest .ofText (text ));
135137 }
136138
137139 /**
138- * 按 sessionKey 发送纯文本 prompt 并指定模型 。
140+ * 按 sessionKey 发送纯文本消息并指定模型 。
139141 */
140- public PromptResult promptByKey (String sessionKey , String text , String providerID , String modelID ) {
141- return httpClient .promptByKey (sessionKey , PromptRequest .ofText (text , providerID , modelID ));
142+ public PromptResult chatCompletionWithSession (String sessionKey , String text , String providerID , String modelID ) {
143+ return httpClient .chatCompletionWithSession (sessionKey , PromptRequest .ofText (text , providerID , modelID ));
142144 }
143145
144146 /**
145- * 按 sessionKey 异步发送 prompt ,不等待响应。
147+ * 按 sessionKey 异步发送消息 ,不等待响应。
146148 */
147- public boolean promptAsyncByKey (String sessionKey , PromptRequest request ) {
148- return httpClient .promptAsyncByKey (sessionKey , request );
149+ public boolean chatCompletionWithSessionAsync (String sessionKey , PromptRequest request ) {
150+ return httpClient .chatCompletionWithSessionAsync (sessionKey , request );
149151 }
150152
151153 /**
0 commit comments