25 lines
649 B
TypeScript
25 lines
649 B
TypeScript
import type {
|
|
RuntimeItemAiIntent,
|
|
RuntimeItemGenerationContext,
|
|
RuntimeItemPlan,
|
|
} from '../types';
|
|
import { requestJson } from './apiClient';
|
|
|
|
export async function generateRuntimeItemAiIntents(params: {
|
|
context: RuntimeItemGenerationContext;
|
|
plans: RuntimeItemPlan[];
|
|
}) {
|
|
const response = await requestJson<{
|
|
intents?: RuntimeItemAiIntent[];
|
|
}>(
|
|
'/api/runtime/items/runtime-intent',
|
|
{
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify(params),
|
|
},
|
|
'运行时物品意图生成失败',
|
|
);
|
|
return Array.isArray(response.intents) ? response.intents : [];
|
|
}
|